![]() |
|
[Python] WebRequests in python? - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Python] WebRequests in python? (/showthread.php?tid=5515313) |
WebRequests in python? - Xogg - Jan 5, 2017 So i know VB.net and to download a site as a string you do something like this i would like to know how to do this in Python, if you need any more additional info please ask. Thanks 🤝 PS: Im using python 2.7 * - Dialog - Jan 5, 2017 Equivalent of your code using urllib2: Code import urllib2* - Goodies - Jan 5, 2017 Except don't use urllib2. Use requests. It's an incredibly common, supported, and featurefull extension that can be downloaded with pip. * - Sandler - Jan 6, 2017 I'd definetly recommend using requests. It's really easy to use and has a good documentation. http://docs.python-requests.org/en/master/ The equivalent to your code would be Code import requests* - Infamia - Jan 6, 2017 Honestly there are a myriad of libraries on requests; sockets urllib urllib2 requests (forgot the rest) Sockets is the Assembly of the Urllib which is C to the Python-level requests. (Sockets = hardest, Urllib = intermediate-ish, Requests = ez pz) * - Xogg - Jan 6, 2017 Bump i still need help. None of the results seemed to work for me. * - xthanos - Jan 6, 2017 PHP Code Please post the error you're getting here. * - Xogg - Jan 7, 2017 (Jan 6, 2017 11:02 PM)#beef Wrote: PHP Code * - Retribute - Jan 7, 2017 (Jan 7, 2017 12:47 AM)Dexuh Wrote:You need to install pip and then use that to install the requests library. * - Xogg - Jan 7, 2017 (Jan 7, 2017 12:49 AM)Retribute Wrote: You need to install pip and then use that to install the requests library. Can you point me in the correct direction, im using a windows machine if that helps. * - Retribute - Jan 7, 2017 (Jan 7, 2017 12:56 AM)Dexuh Wrote: Can you point me in the correct direction, im using a windows machine if that helps.The installation docs: https://pip.pypa.io/en/stable/installing * - Sandler - Jan 7, 2017 (Jan 7, 2017 12:56 AM)Dexuh Wrote: Can you point me in the correct direction, im using a windows machine if that helps. If you are using pip, just type "pip install requests" in your console, this will install the requests library. * - Ensky - Jan 9, 2017 (Jan 7, 2017 12:56 AM)Dexuh Wrote: Can you point me in the correct direction, im using a windows machine if that helps. You should have it, if not read this, if you do have it just type "pip install requests" in the command line. * - SIM-1866423 - Jan 9, 2017 PHP Code * - xthanos - Jan 11, 2017 You don't have pip installed. Ok so firstly you need python in your enviroment variable: https://www.youtube.com/watch?v=hKvJL6AlTI8 This is extrememly useful ^^ After you've done all that, you may need to restart pc. Type into CMD : PHP Code |