Skip to content

Instantly share code, notes, and snippets.

@Popcore
Last active February 16, 2018 17:16
Show Gist options
  • Select an option

  • Save Popcore/38e2a0ff326e5f0956281d68c4eec6f1 to your computer and use it in GitHub Desktop.

Select an option

Save Popcore/38e2a0ff326e5f0956281d68c4eec6f1 to your computer and use it in GitHub Desktop.
Run a Thingful pipe programmatically with python
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