Skip to content

Commit

Permalink
chore(oauth2): move quickstart files into dedicated folder
Browse files Browse the repository at this point in the history
  • Loading branch information
davinov authored and luc-leonard committed Oct 14, 2020
1 parent 77bb46e commit 30e542f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
3 changes: 1 addition & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ exclude_lines =
# Files to exclude from consideration
omit =
# Utilities for OAuth2 connectors testing
oauth_connector_quickstart.py
toucan_connectors/oauth2_connector/oauth2_authorization_webserver.py
toucan_connectors/oauth2_connector/quickstart
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sonar.projectVersion=0.41.4

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
sonar.sources=./toucan_connectors
sonar.coverage.exclusions=./toucan_connectors/install_scripts,./toucan_connectors/oauth2_connector/oauth2_authorization_webserver.py
sonar.coverage.exclusions=./toucan_connectors/install_scripts,./toucan_connectors/oauth2_connector/quickstart
sonar.test.inclusions=./tests

# Encoding of the source code. Default is default system encoding
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
"""
Use this file to initiate the OAuth2 dance and test the connectors that requires it.
"""

from toucan_connectors.google_sheets_2.google_sheets_2_connector import (
GoogleSheets2Connector,
GoogleSheets2DataSource,
)
from toucan_connectors.oauth2_connector.oauth2_authorization_webserver import (
JsonFileSecretsKeeper,
get_authorization_response,
)

from .helpers import JsonFileSecretsKeeper, get_authorization_response

# Get these info from the provider
CLIENT_ID = ''
CLIENT_SECRET = ''
# ...and give this one to the provider
REDIRECT_URI = 'http://localhost:34097/'

google_sheets_conn = GoogleSheets2Connector(
Expand All @@ -17,16 +21,20 @@
client_id=CLIENT_ID,
client_secret=CLIENT_SECRET,
redirect_uri=REDIRECT_URI,
secrets_keeper=JsonFileSecretsKeeper(filename="secrets.json"),
secrets_keeper=JsonFileSecretsKeeper(filename='secrets.json'),
)
sample_data_source_ss = GoogleSheets2DataSource(
name='test',
domain='test-connector',
spreadsheet_id='1L5YraXEToFv7p0HMke7gXI4IhJotdT0q5bk_PInI1hA',
)

# authorization_response = get_authorization_response(google_sheets_conn.build_authorization_url(), 'localhost', 34097)
# google_sheets_conn.retrieve_tokens(authorization_response)
# The OAuth2 authorization process
authorization_response = get_authorization_response(
google_sheets_conn.build_authorization_url(), 'localhost', 34097
)
google_sheets_conn.retrieve_tokens(authorization_response)

# The actual data request
df = google_sheets_conn.get_df(data_source=sample_data_source_ss)
print(df)

0 comments on commit 30e542f

Please sign in to comment.