jmichaelward / py-bgg

A Python playground.
1 stars 0 forks source link

urllib is not the preferred module #3

Open genghis opened 4 years ago

genghis commented 4 years ago

In general, the preferred http requests library is, simply requests.

Smarter people than me, here: https://stackoverflow.com/questions/2018026/what-are-the-differences-between-the-urllib-urllib2-urllib3-and-requests-modul

jmichaelward commented 4 years ago

I've made this update: https://github.com/jmichaelward/py-bgg/commit/ffa9f01b23a7ebaac8b4c11e0f08380df06f0cbc https://github.com/jmichaelward/py-bgg/commit/b2eb6156d8bf3d6a377217c8a1ee0a9017bc6e84

(Forgive the links - in a truly collaborative project, this would assuredly become a PR).

I'm surprised the accepted answer on SO is still relevant given its age. It was fairly trivial to replace the external library with the native one, I just had to update a few references to the object since it carries some different properties.

Note that the urllib.request documentation on Python.org includes a recommendation for the requests library for "a higher-level HTTP client interface", so this seems like a solid standard to use across projects.