Skip to content

Instantly share code, notes, and snippets.

@jmwenda
Last active December 17, 2015 16:09
Show Gist options
  • Save jmwenda/5636949 to your computer and use it in GitHub Desktop.
Save jmwenda/5636949 to your computer and use it in GitHub Desktop.
import requests
import os
import json
from requests.auth import HTTPBasicAuth
def upload(uploadfile,title,description):
#with the parameters we go authenticate
payload = {'username': 'jmwenda', 'password': 'blahblah','submit':'Login','api_key':'mysample'}
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
r = requests.post("https://mysourcemap.com/member/login?format=json", data=json.dumps(payload),headers=headers)
#requests.get('http://beta.mysourcemap.com/member/login?format=json', auth=HTTPBasicAuth('jmwenda', 'blahblah'))
#print requests.
import pdb;pdb.set_trace()
# print r.json()
print r.text
upload = upload("uploadfile","title","description")
print 'this is the upload'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment