diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/break.py | 29 | ||||
| -rw-r--r-- | examples/jsonp.sh | 2 |
2 files changed, 31 insertions, 0 deletions
diff --git a/examples/break.py b/examples/break.py new file mode 100644 index 0000000..6f0c710 --- /dev/null +++ b/examples/break.py @@ -0,0 +1,29 @@ +#!/usr/bin/python2.7 +import requests, sys +import simplejson as json +URL_BASE = "http://127.0.0.1:5000" + +example_params = { + "url" : "http://i.asdf.us/im/de/HolyMountain2_1322275112_seamonkey.gif", + "breaktype" : "RGB_WASH", + "finalformat" : "png", + "breakmode" : "extreme", + "breakangle" : "10", + "username" : "donkey", + "expanded" : "false" +} + +def post_request(url, data): + r = requests.post(url, data=data) + if r.status_code != 200: + sys.stderr.write("ERROR: %s\n" % r.status_code) + sys.stderr.write("REASON: %s\n" % r.reason) + sys.exit(1) + return json.loads(r.text) + +def test(api_name, params): + return post_request("%s/%s" % (URL_BASE, api_name), params) + +if __name__ == "__main__": + print test("PbBreak", example_params) + diff --git a/examples/jsonp.sh b/examples/jsonp.sh new file mode 100644 index 0000000..8539853 --- /dev/null +++ b/examples/jsonp.sh @@ -0,0 +1,2 @@ +#!/bin/bash +curl 'http://asdf.us/cgi-bin/im/generate?callback=jsonp1431361693303&url=http%3A%2F%2Fwww.maskworld.com%2Fpix%2Fmasks%2F025-party-face-gesicht-fasching-karneval-carnival-halloween-latex-film-movie-larp-theatre-theater-horror-rubber-gummi-mask-masks-maske-masken.jpg&name=test&transparent=true&fuzz=5' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36' -H 'Accept: */*' -H 'Referer: http://carbonpictures.com/pb/' -H 'Cookie: imname=yo' -H 'Connection: keep-alive' --compressed |
