diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-06-23 09:51:07 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-06-23 09:51:07 +0200 |
commit | 88180acfb56ef5ab758023bb33bbb92154bed93a (patch) | |
tree | 0b2630e6dd2310f2910d6a03abbc1d5480b66cd5 /README.rst | |
parent | It is now possible to add new articles with the API! (diff) | |
download | newspipe-88180acfb56ef5ab758023bb33bbb92154bed93a.tar.gz newspipe-88180acfb56ef5ab758023bb33bbb92154bed93a.tar.bz2 newspipe-88180acfb56ef5ab758023bb33bbb92154bed93a.zip |
Updated README.
Diffstat (limited to 'README.rst')
-rw-r--r-- | README.rst | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -175,6 +175,22 @@ To get an article: $ curl --user your-email:your-password "https://pyaggr3g470r.herokuapp.com/api/v1.0/articles/84566" +Add an article: + +.. code:: python + + >>> import requests, json + >>> headers = {'Content-type': 'application/json', 'Accept': 'application/json'} + >>> payload = {'link': 'http://blog.cedricbonhomme.org/2014/05/24/sortie-de-pyaggr3g470r-5-3/', 'title': 'Sortie de pyAggr3g470r 5.3', 'content':'La page principale de pyAggr3g470r a été améliorée...', 'date':str(datetime.datetime.now()), 'feed_id':'42'} + >>> r = requests.post("https://pyaggr3g470r.herokuapp.com/api/v1.0/articles/0", headers=headers, auth=("your-email", "your-password"), data=json.dumps(payload)) + >>> print r.content + { + "message": "ok" + } + >>> r = requests.get("https://pyaggr3g470r.herokuapp.com/api/v1.0/articles?feed=42&limit=1", auth=("your-email", "your-password")) + >>> print json.loads(r.content)["result"][0]["title"] + Sortie de pyAggr3g470r 5.3 + >>> Donation ======== |