Sep-02-2018, 04:15 PM
(This post was last modified: Sep-02-2018, 04:16 PM by dalaludidu.)
(Sep-02-2018, 02:24 PM)metulburr Wrote: I dont even get that with your code. I get html code if i change your respage variable to res. Where do you define ResPage? As you only define res.
Anyways the more common approach now is to use the requests module.
import requests r = requests.get('http://www.bing.com') print(r.text) print(r.headers['content-type'])
Thanks a lot!
Sorry for the confusion about the variable names, I meant to use the 'res' all the way.
Seems I need to abandon the old school way of doing the http things...
I just have one more question: should I regard Requests as a total replacement for the old urllib things? Would you mind give some sayings about this?
Regards