views:

28

answers:

2
https://graph.facebook.com/

I need to make an HTTPS request to that. And then get the params back. How to do that?

A: 

Use libhttp2:

import httplib2
h = httplib2.Http(".cache")
resp, content = h.request("https://graph.facebook.com/", "GET")


>>> import httplib2
>>> h = httplib2.Http(".cache")
>>> resp, content = h.request("https://graph.facebook.com/", "GET")
>>> print resp
{'status': '200', 'content-length': '26244', 'content-location': 'http://developers.facebook.com/docs/api', 'transfer-encoding': 'chunked', 'set-cookie': 'PHPSESSID=d3cc7702c0fa0ea30eb9fd82cd93aa10; path=/, datr=1273298829-77768393a90862aba5e814235278103be75902e4150eea9368624; expires=Mon, 07-May-2012 06:07:09 GMT; path=/; domain=.facebook.com', 'expires': 'Thu, 19 Nov 1981 08:52:00 GMT', 'server': 'Apache/1.3.41.fb2', 'connection': 'close', '-content-encoding': 'gzip', 'pragma': 'no-cache', 'cache-control': 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0', 'date': 'Sat, 08 May 2010 06:07:09 GMT', 'p3p': 'CP="DSP LAW"', 'content-type': 'text/html; charset=utf-8'}
heckj
Is this httpS? (secure)
TIMEX
A: 
import urllib2

r = urllib2.urlopen('https://graph.facebook.com')
print r.info()
html = r.read()
J.F. Sebastian