示例#1
0
    def __init__(self,
                 api_key,
                 api_secret,
                 data_type="json",
                 timeout=15,
                 version=API_VERSION_2):
        """Create a new Zoom client

        :param api_key: The Zooom.us API key
        :param api_secret: The Zoom.us API secret
        :param data_type: The expected return data type. Either 'json' or 'xml'
        :param timeout: The time out to use for API requests
        """
        try:
            BASE_URI = API_BASE_URIS[version]
            self.components = COMPONENT_CLASSES[version].copy()
        except KeyError:
            raise RuntimeError("API version not supported: %s" % version)

        super(ZoomClient, self).__init__(base_uri=BASE_URI, timeout=timeout)

        # Setup the config details
        self.config = {
            "api_key": api_key,
            "api_secret": api_secret,
            "data_type": data_type,
            "version": version,
            "token": util.generate_jwt(api_key, api_secret),
        }

        # Instantiate the components
        for key in self.components.keys():
            self.components[key] = self.components[key](base_uri=BASE_URI,
                                                        config=self.config)
 def test_init_sets_config(self):
     client = ZoomClient('KEY', 'SECRET')
     self.assertEqual(
         client.config, {
             'api_key': 'KEY',
             'api_secret': 'SECRET',
             'data_type': 'json',
             'token': util.generate_jwt('KEY', 'SECRET'),
             'version': API_VERSION_2,
         })
示例#3
0
 def test_init_sets_config(self):
     client = ZoomClient("KEY", "SECRET")
     self.assertEqual(
         client.config,
         {
             "api_key": "KEY",
             "api_secret": "SECRET",
             "data_type": "json",
             "token": util.generate_jwt("KEY", "SECRET"),
             "version": API_VERSION_2,
         },
     )
示例#4
0
    def __init__(
        self,
        api_key,
        api_secret,
        data_type="json",
        timeout=15,
        version=API_VERSION_2,
        base_uri=None,
    ):
        """Create a new Zoom client

        :param api_key: The Zooom.us API key
        :param api_secret: The Zoom.us API secret
        :param data_type: The expected return data type. Either 'json' or 'xml'
        :param timeout: The time out to use for API requests
        :param version: The API version to use (Default is V2). The available
                        options are API_VERSION_1 (deprecated by Zoom),
                        or API_VERSION_2 (default)
        :param base_uri: Set the base URI to use. By default this is chosen
                         based on the API version chosen, but it can be
                         overriden so that the GDPR compliant base URI can
                         be used in the EU.
        """
        try:
            base_uri = base_uri or API_BASE_URIS[version]
            self.components = COMPONENT_CLASSES[version].copy()
        except KeyError:
            raise RuntimeError("API version not supported: %s" % version)

        super(ZoomClient, self).__init__(base_uri=base_uri, timeout=timeout)

        # Setup the config details
        self.config = {
            "api_key": api_key,
            "api_secret": api_secret,
            "data_type": data_type,
            "version": version,
            "base_uri": base_uri,
            "token": util.generate_jwt(api_key, api_secret),
        }

        # Instantiate the components
        for key in self.components.keys():
            self.components[key] = self.components[key](base_uri=base_uri,
                                                        config=self.config)
示例#5
0
 def refresh_token(self):
     self.config["token"] = (util.generate_jwt(self.config["api_key"],
                                               self.config["api_secret"]), )
示例#6
0
 def refresh_token(self):
     self.config['token'] = util.generate_jwt(self.config['api_key'],
                                              self.config['api_secret']),