Last active
February 16, 2018 17:16
-
-
Save Popcore/38e2a0ff326e5f0956281d68c4eec6f1 to your computer and use it in GitHub Desktop.
Run a Thingful pipe programmatically with python
This file contains hidden or 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 os | |
| // use the internal URL as requests strips authorization headers on redirects | |
| url = "https://thingful-pipes.herokuapp.com/api/run/4e9ce2e7-50b9-4fdb-a491-ff4d6da72700" | |
| // ensure token is set in the environment | |
| token = os.getenv("PIPES_TOKEN") | |
| if token is None: | |
| raise TypeError("PIPES_TOKEN must be set in the environment") | |
| // set headers and fire request | |
| headers = {'Authorization': 'Bearer {}'.format(token)} | |
| resp = requests.get(url, headers=headers) | |
| // log json response | |
| print(resp.json()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment