The requests library

As in many other cases, Python has a built-in library to deal with HTTP requests—urllib. It is a great package that allows the handling of requests via a low-level technical interface. We will, however, use requests—a third-party library with a high-level (simpler) interface that uses urllib under the hood. As a third-party library, requests requires separate installation. However, if you have Anaconda Distribution installed, don't worry—requests is already installed!

The library supports many advanced options, including sessions, authentication, and Secure Sockets Layer (SSL) certificates. In this case, however, the only thing we need is the get method of requests, which takes the request URL and optional parameters as arguments. Let's now try using requests.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset