Esempio n. 1
0
    def __init__(self, customer_id=None, auth_token=None, **kwargs):
        try:
            from dotenv import Dotenv
            dotenv = Dotenv(os.path.join(os.getcwd(), '.env'))
            os.environ.update(dotenv)
        except:
            sys.stderr.write('Skipping load of .env...\n')
            sys.stderr.write(traceback.format_exc())

        if not customer_id:
            customer_id = os.environ['RED_CANARY_CUSTOMER_ID']

        if not auth_token:
            auth_token = os.environ['RED_CANARY_AUTH_TOKEN']

        request_options = dict(params={'auth_token': auth_token})
        request_options.update(kwargs.pop('request_options', None) or {})

        RestClient.__init__(self,
                            'https://%s.my.redcanary.co/openapi/v2' %
                            customer_id,
                            request_options=request_options,
                            **kwargs)
Esempio n. 2
0
 def __init__(self, api_key=None):
     RestClient.__init__(self, 'http://www.omdbapi.com', api_key,
                         'OMDB_API_KEY')
     self.api_key_argname = 'apikey'
Esempio n. 3
0
 def __init__(self, api_key=None):
     RestClient.__init__(self, 'https://api.themoviedb.org/3', api_key,
                         'TMDB_API_KEY')
     self.api_key_argname = 'api_key'