Which urllib I should choose?

Mathew P. Jones picture Mathew P. Jones · Dec 9, 2013 · Viewed 22.8k times · Source

as we know, python has two built-in url lib:

  • urllib
  • urllib2

and a third-party lib:

  • urllib3

if my requirement is only to request a API by GET method, assume it return a JSON string.
which lib I should use? do they have some duplicated functions?
if the urllib can implement my require, but after if my requirements get more and more complicated, the urllib can not fit my function, I should import another lib at that time, but I really want to import only one lib, because I think import all of them can make me confused, I think the method between them are totally different.

so now I am confused which lib I should use, I prefer urllib3, I think it can fit my requirement all time, how do you think?

Answer

Daniel Roseman picture Daniel Roseman · Dec 9, 2013

As Alexander says in the comments, use requests. That's all you need.