Question

I'm trying to implement an OAuth2 authentication server and for the client part i wanted to send a json request to the server (from a Django view) and i found several libraries to do that tho' the most common are httplib2 and urllib2 i was wondering which is the difference between them and which is the best library for this purpose.

Thanks in advance.

Edit: After searching, i found an extremely useful library called Requests and i use this one since then. (http://docs.python-requests.org/en/latest/)

Was it helpful?

Solution

urllib2 handles opening and reading URLs. It also handles extra stuff like storing cookies.

httplib handles http requests, its what happens behind the curtain when you open a url.

you can send json request with urllib2 so you should use that. see this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top