Commit 62d137cb authored by alexandre's avatar alexandre

Snapshot code wip

parent 884d101e
import os
import requests
api_key = "ZEojF6PGrOomABIXDf4igo9XfCdWaZL5"
pad_id = "metahoguet"
base_url = ""
api_url = "{}/api/1/".format(base_url)
params = {"padID": pad_id, "apikey": api_key}
outdir = "/tmp/foobar"
letter = "A"
r = requests.get('{}getRevisionsCount'.format(api_url), params=params)
rev = r.json().get("data").get("revisions")
rev_dir = os.path.join(outdir, "{}_{}".format(rev, letter))
r = requests.get('{}getText'.format(api_url), params=dict(revision=rev, **params))
text = r.json().get("data").get("text")
fn = os.path.join(rev_dir, "")
f = open(fn, "w")
# && mpost -interaction=batchmode
# Downloads the latest revision and get the line number of the given fig
curl -s | grep -n "beginfig($1)"
curl -s\?padID\=metamonday\&apikey\=ZEojF6PGrOomABIXDf4igo9XfCdWaZL5 | python -c 'import sys, json; print(json.load(sys.stdin)["data"]["revisions"])'
curl -s\?padID\=metamonday\&revision\=17186\&apikey\=ZEojF6PGrOomABIXDf4igo9XfCdWaZL5 | python -c 'import sys, json; print(json.load(sys.stdin)["data"]["text"])'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment