<commit_before># -*- encoding:utf8 -*-

import os
from oauth2client.client import OAuth2WebServerFlow


class OAuth:

    def __init__(self):
        pass

    def get_flow(self):
        scope = 'https://www.googleapis.com/auth/drive'

        try:
            client_id = os.environ['GOOGLE_CLIENT_ID']
            client_secret = os.environ['GOOGLE_CLIENT_SECRET']
            base_url = os.environ['BOTNYAN_BASE_URL']
            separator = "/"
            if base_url.endswith("/"):
                separator = ""
            redirect_url = "{0}{1}drive/callback".format(base_url, separator)
            flow = OAuth2WebServerFlow(client_id=client_id,
                                       client_secret=client_secret,
                                       scope=scope,
                                       redirect_uri=redirect_url)
            return flow
        except:
            return None<commit_msg>Fix GoogleDrive OAuth callback URL in OAuth module.<commit_after># -*- encoding:utf8 -*-

import os
from oauth2client.client import OAuth2WebServerFlow


class OAuth:

    def __init__(self):
        pass

    def get_flow(self):
        scope = 'https://www.googleapis.com/auth/drive'

        try:
            client_id = os.environ['GOOGLE_CLIENT_ID']
            client_secret = os.environ['GOOGLE_CLIENT_SECRET']
            base_url = os.environ['BOTNYAN_BASE_URL']
            separator = "/"
            if base_url.endswith("/"):
                separator = ""
            redirect_url = "{0}{1}api/drive/callback".format(base_url, separator)
            flow = OAuth2WebServerFlow(client_id=client_id,
                                       client_secret=client_secret,
                                       scope=scope,
                                       redirect_uri=redirect_url)
            return flow
        except:
            return None
{'fraction_non_alphanumeric': 0.09148936170212765, 'fraction_numerical': 0.006382978723404255, 'mean_word_length': 1.5909090909090908, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2795159', 'n_tokens_mistral': 526, 'n_tokens_neox': 506, 'n_words': 88}