Created
July 6, 2012 11:03
-
-
Save deiu/3059539 to your computer and use it in GitHub Desktop.
Uses a certificate (in PEM) to authenticate (through WebID) and access a protected page.
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
#!/usr/bin/env python | |
import urllib | |
import httplib2 | |
cert_file = 'my.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']} | |
newurl = 'https://my-profile.eu/test.php' | |
response, content = http.request(newurl, 'GET', headers=headers) | |
print content |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment