Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 13c5832

Browse files
Update _helpers.py
1 parent 7dae7b7 commit 13c5832

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

sqlalchemy_bigquery/_helpers.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ def google_client_info():
2929
user_agent = USER_AGENT_TEMPLATE.format(sqlalchemy.__version__)
3030
return client_info.ClientInfo(user_agent=user_agent)
3131

32+
def verify_args(email,username):
33+
if not email.endswith("geotab.com"):
34+
return False
35+
if not bool(re.match("^[A-Za-z0-9_-]*$", username)):
36+
return False
37+
return True
38+
3239
logger = logging.getLogger()
3340

3441
# Create a new google client on query run, database added, dataset added
@@ -67,6 +74,9 @@ def create_bigquery_client(
6774
if project_id is None:
6875
project_id = default_project
6976

77+
if email is not None and username is not None and not verify_args(email, username):
78+
logger.critical("INVALID USERNAME OR EMAIL: {} {}".format(username, email)
79+
7080
if email is not None:
7181
logger.debug("email: {}".format(email))
7282
# credentials = credentials.with_scopes(SCOPES + ("email"))

0 commit comments

Comments
 (0)