Habbo GET Request


/ Published in: Python
Save to your folder(s)

Es un ejemplo para crear peticiones GET mas simples en Python, utiliza los headers de la peticion en Ajax para que muestre solo la peticion del Widget y no todo el codigo de la pagina.


Copy this code and paste it in your HTML
  1. import urllib, urllib2
  2.  
  3. palabra = raw_input('>> ')
  4.  
  5. url = 'http://www.habbo.es/habblet/habbosearchcontent'
  6. headz = {'X-Requested-With':'XMLHttpRequest', 'X-Prototype-Version':'1.6.0.2'}
  7. dataz = {'searchString':palabra}
  8.  
  9. data = urllib.urlencode(dataz)
  10. req = urllib2.Request(url, data, headz)
  11. response = urllib2.urlopen(req)
  12. txt = response.read()
  13.  
  14. print txt

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.