Created
December 22, 2015 05:33
-
-
Save davidthewatson/7578f0f9c84aa129cd66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import requests_jwt | |
import json | |
# email and password auth through postgrest | |
resp = requests.post('http://localhost:3000/rpc/login', json={"email": "you@yours.com", "pass": "dog"}) | |
print resp # <Response [200]> | |
# JWT token-based auth through postgrest using the returned token from above | |
auth = requests_jwt.JWTAuth(json.loads(resp.text)['token']) | |
r = requests.get('http://localhost:3000/weight', auth=auth) | |
for each in r.json(): | |
print(each) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment