<commit_before>from urlparse import urljoin
import requests
from urllib import urlencode
from .log import get_logger

logger = get_logger('OAuth2Client')


class OAuth2Client(object):
    '''
    OAuth2 client that can be used by cdis internal
    microservices to acquire oauth token

    '''
    def __init__(self, client_id, client_secret, redirect_uri,
                 oauth_provider='https://bionimbus-pdc.opensciencedatacloud.org/api/oauth2',
                 scope='user'):
        self.client_id = client_id
        self.client_secret = client_secret
        self.oauth_provider = oauth_provider
        self.redirect_uri = redirect_uri
        self.scope = scope

    @property
    def authorization_url(self):
        '''
        url to get temporary code
        this url can be used to get authorization code
        from browser if user is authenticated in oauth provider
        '''
        return (
            urljoin(self.oauth_provider, 'authorize') +
            '?' +
            urlencode(dict(client_id=self.client_id,
                           redirect_uri=self.redirect_uri,
                           response_type='code',<commit_msg>fix(default): fix default oauth provider url<commit_after>from urlparse import urljoin
import requests
from urllib import urlencode
from .log import get_logger

logger = get_logger('OAuth2Client')


class OAuth2Client(object):
    '''
    OAuth2 client that can be used by cdis internal
    microservices to acquire oauth token

    '''
    def __init__(self, client_id, client_secret, redirect_uri,
                 oauth_provider='https://bionimbus-pdc.opensciencedatacloud.org/api/oauth2/',
                 scope='user'):
        self.client_id = client_id
        self.client_secret = client_secret
        self.oauth_provider = oauth_provider
        self.redirect_uri = redirect_uri
        self.scope = scope

    @property
    def authorization_url(self):
        '''
        url to get temporary code
        this url can be used to get authorization code
        from browser if user is authenticated in oauth provider
        '''
        return (
            urljoin(self.oauth_provider, 'authorize') +
            '?' +
            urlencode(dict(client_id=self.client_id,
                           redirect_uri=self.redirect_uri,
                           response_type='code',
{'fraction_non_alphanumeric': 0.07306711979609176, 'fraction_numerical': 0.0033984706881903144, 'mean_word_length': 2.284518828451883, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4400626', 'n_tokens_mistral': 645, 'n_tokens_neox': 632, 'n_words': 166}