nyk0r

APIs are almost the same

Jan 23rd, 2012
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. Python 2.7
  2. >>> import httplib
  3. >>> conn = httplib.HTTPConnection("2ch.so")
  4. >>> conn.request("GET", "/menu.html")
  5. >>> r = conn.getresponse()
  6. >>> r.read().split('\n')
  7. >>> conn.close()
  8.  
  9. Python 3.2
  10. >>> from http import client
  11. >>> conn = client.HTTPConnection(r'2ch.so')
  12. >>> conn.request('GET', '/menu.html')
  13. >>> r = conn.getresponse()
  14. >>> r.readlines()
  15. >>> conn.close()
Advertisement
Add Comment
Please, Sign In to add comment