From bdfb0a76806df13eb8f56b238af77de4aa5f3427 Mon Sep 17 00:00:00 2001 From: David Watson Date: Tue, 22 Dec 2015 01:26:23 -0500 Subject: [PATCH] Layout tweaks --- docs/examples/python-requests-jwt.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/examples/python-requests-jwt.md b/docs/examples/python-requests-jwt.md index 57a56555f..ab2cfdd98 100644 --- a/docs/examples/python-requests-jwt.md +++ b/docs/examples/python-requests-jwt.md @@ -1,9 +1,5 @@ ## Accessing PostgREST API using Python Requests and Requests-JWT -The following HTTP client example should work on Python 3.x. If you're using python < 3.x you may need to change the print functions to statements or use: - - from __future__ import print_function - This code relies on setting up the PostgreSQL auth functions and grants correctly first. Follow these instructions: http://postgrest.com/examples/users/ @@ -13,7 +9,7 @@ After completing the configuration, be sure to create a user with email, passwor Install the required libraries pip install requests - pip install Requests-jwt + pip install requests-jwt Then, from a python interpreter or script: @@ -32,6 +28,11 @@ Then, from a python interpreter or script: r = requests.get('http://localhost:3000/weight', auth=auth) if r.status_code != 200: raise Exception() - + for each in r.json(): - print(each) + # do as you wish with each row + print(each) + +The preceding HTTP client example should work on Python 3.x. If you're using python < 3.x you may need to change the print functions to statements or use: + + from __future__ import print_function