This is one way to use Tor with the Request Library in Python. I hope you will find it useful.
pre-requisite:
- Install Tor Browser.
- Open Tor Browser before running this code.
- pip install requests
- pip install requests[socks]
- pip install requests[security]
This code is written in Python 3.7