3 ms·
To give a specific example, there's a lot of headache that new Python users could be spared if only they used requests instead of urllib2. But they don't know t
by int_19h 8y ago
To give a specific example, there's a lot of headache that new Python users could be spared if only they used requests instead of urllib2. But they don't know that it's compelling if they never go look, and just stick to stdlib.
- anoncake 8y agoGood point. However, there's a box saying that request is recommended at the top of the urllib.request docs. https://docs.python.org/3.8/library/urllib.request.html#module-urllib.request https://docs.python.org/3.8/library/urllib.request.html#modu...
- ben509 8y agoUnfortunately, I think people usually search StackOverflow, or just type into Google and get pointed to SO. If they type in "how do I download a web page in python" they get: 1. urllib [1] 2. BeautifulSoup and a comment mentioning requests [2] 3. requests [3] 4. urllib, httplib [4] Which is looking better than I expected... but no information on 2 or 3 relating to how you install those libraries. So 1 and 4 will Just Work. [1]: https://stackoverflow.com/questions/45717889/read-the-text-of-an-web-page-in-python https://stackoverflow.com/questions/45717889/read-the-text-o... [2]: https://stackoverflow.com/questions/26050064/automating-download-of-executable-which-is-within-several-nested-urls-by-listeni https://stackoverflow.com/questions/26050064/automating-down... [3]: https://stackoverflow.com/questions/44553348/how-to-download-from-an-html-link-href-in-python https://stackoverflow.com/questions/44553348/how-to-download... [4]: https://stackoverflow.com/questions/2646288/retrieve-some-info-from-the-web-automatically https://stackoverflow.com/questions/2646288/retrieve-some-in...
- pfranz 8y agoI'd love if something like requests was included along with Python. But requests uses urllib3, so it's not like you could get rid of that. The main page for requests says they're working on a v3...you wouldn't want that kind of churn in the stdlib. Personally, I kind of like the structure of low-level libraries and fancier high-level libraries I use most often. So I'm not quite sure what is the best thing to do. It sounds like requests III is a Python3 forward version. So it might make sense to ship that? Python has decided to include packages developed outside of the stdlib before; I think json, pathlib, and maybe optparse.