Skip to content

Instantly share code, notes, and snippets.

@melvincarvalho
Created July 10, 2012 09:46
Show Gist options
  • Save melvincarvalho/3082339 to your computer and use it in GitHub Desktop.
Save melvincarvalho/3082339 to your computer and use it in GitHub Desktop.
command line to MyProfile
#!/usr/bin/env python
import urllib
import httplib2
cert_file = 'e.pem'
http = httplib2.Http(disable_ssl_certificate_validation=True)
http.add_certificate('', cert_file, domain='')
url = 'https://auth.my-profile.eu/auth/index.php?authreqissuer=https://my-profile.eu/index.php'
response, content = http.request(url)
headers = {'Cookie': response['set-cookie'], 'Content-type': 'application/x-www-form-urlencoded'}
newurl = 'https://my-profile.eu/wall.php'
body = { 'comment' : 'curltest', 'user' : 'local', 'new' : '1' }
response, content = http.request(newurl, 'POST', headers=headers, body=urllib.urlencode(body))
print content
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment