From 88180acfb56ef5ab758023bb33bbb92154bed93a Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Mon, 23 Jun 2014 09:51:07 +0200 Subject: Updated README. --- README.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.rst b/README.rst index 53df6b52..be048e57 100644 --- a/README.rst +++ b/README.rst @@ -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 ======== -- cgit