Implementing a client with requests_oauthlib
The requests-oauthlib
, https://pypi.org/project/requests-oauthlib, is a module that helps us to implement OAuth clients in Python. This module glues together two main components: the requests
package and oauthlib
. From within your virtual environment, you can install it with the following command:
$ pip install requests_oauthlib
The following example is intended to use the GitHub service and register an application that allows us to obtain the credentials to authorize the use of the application. As a first step, in the OAuth Apps section within the Developer settings (https://github.com/settings/developers) option, we could create our test application.
Figure 4.3: Creating an OAuth app in GitHub service
When creating an application, we must introduce the application name, home page URL, and Authorization callback URL.
Figure 4.4: Creating an OAuth app in the GitHub service
Once we have created our test...