https://github.com/joeyism/py-oauth2_google_login
Gets OAuth2 access token from Google/YouTube automatically using requests_oauthlib
https://github.com/joeyism/py-oauth2_google_login
google oauth2 oauth2-access requests-oauthlib webdriver youtube
Last synced: 2 months ago
JSON representation
Gets OAuth2 access token from Google/YouTube automatically using requests_oauthlib
- Host: GitHub
- URL: https://github.com/joeyism/py-oauth2_google_login
- Owner: joeyism
- License: other
- Created: 2018-02-13T07:13:47.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-24T12:01:37.000Z (over 8 years ago)
- Last Synced: 2025-07-20T16:41:03.114Z (11 months ago)
- Topics: google, oauth2, oauth2-access, requests-oauthlib, webdriver, youtube
- Language: Python
- Size: 8.79 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# oauth2_google_login
Gets OAuth2 access token from Google/YouTube automatically, using [requests_oauthlib](https://github.com/requests/requests-oauthlib)
I developed this when I found that I needed to get data from Google and YouTube API automatically, but there was always the human entry for OAuth2 flow. This library takes care of that with your selected webdriver
## Installation
```bash
pip3 install --user oauth2_google_login
```
## Usage
### With Default Chrome Webdriver
First, setup Chrome Webdriver so that it is in PATH, which can be done in terminal
```bash
export PATH=$PATH:/home/username/Downloads/chromedriver
```
Then in Python, run
```python
from oauth2_google_login import get_access_token
auth = get_access_token(
email = "user@email.com",
password = "password",
client_id="1234567",
client_secret="a1b2c3d4e5",
scope = ['https://www.googleapis.com/auth/yt-analytics.readonly', "https://www.googleapis.com/auth/youtube.readonly"]
)
auth.access_token # Facebook access token
```
### With Custom Webdriver
```python
from oauth2_google_login import get_access_token
from selenium import webdriver
driver = webdriver.Chrome("/home/username/Downloads/chromedriver")
auth = get_access_token(
email = "user@email.com",
password = "password",
client_id="1234567",
client_secret="a1b2c3d4e5",
scope = ['https://www.googleapis.com/auth/yt-analytics.readonly', "https://www.googleapis.com/auth/youtube.readonly"],
driver = driver
)
auth.access_token # Facebook access token
```
## Versions
**1.0.x**
* First Publish