Skip to content

Instantly share code, notes, and snippets.

@tingley
Created March 7, 2017 20:09
Show Gist options
  • Save tingley/dc968411d12c348949b2741bc54a65fe to your computer and use it in GitHub Desktop.
Save tingley/dc968411d12c348949b2741bc54a65fe to your computer and use it in GitHub Desktop.
Calling longhorn API from python
import requests
url = 'http://localhost:8080/okapi-longhorn/'
response = requests.post(url+'projects/new')
# create a new project
response = requests.get(url+'projects/')
# push a file
payload = "hello world!"
headers = {'accept-encoding': 'multipart/form-data', 'content-type': 'text/html'}
response = requests.put(url+'projects/1/inputFiles/test2.html', files=dict(inputFile=payload))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment