Last active
December 17, 2015 16:09
-
-
Save jmwenda/5636949 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 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