Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setUp(self):
self.component = components.meeting.MeetingComponentV2(
base_uri="http://foo.com",
config={
"api_key": "KEY",
"api_secret": "SECRET",
"version": util.API_VERSION_2,
},
def setUp(self):
self.component = components.report.ReportComponentV2(
base_uri="http://foo.com",
config={
"api_key": "KEY",
"api_secret": "SECRET",
"version": util.API_VERSION_2,
},
def test_api_version_defaults_to_2(self):
client = ZoomClient("KEY", "SECRET")
self.assertEqual(client.config["version"], util.API_VERSION_2)
def setUp(self):
self.component = components.meeting.MeetingComponentV2(
base_uri="http://foo.com",
config={
"api_key": "KEY",
"api_secret": "SECRET",
"version": util.API_VERSION_2,
},
def test_v2_post_request_passes_jwt_token(self):
component = components.base.BaseComponent(
base_uri="http://www.foo.com",
config={
"api_key": "KEY",
"api_secret": "SECRET",
"version": util.API_VERSION_2,
"token": 42,
},
)
responses.add(
responses.POST,
"http://www.foo.com/foo",
headers={"Authorization": "Bearer 42"},
)
component.post_request("foo")
def setUp(self):
self.component = components.webinar.WebinarComponentV2(
base_uri="http://foo.com",
config={
"api_key": "KEY",
"api_secret": "SECRET",
"version": util.API_VERSION_2,
},
def test_can_post_request_with_json_data_v2(self):
responses.add(
responses.POST, "http://www.foo.com/endpoint",
)
client = util.ApiClient(
base_uri="http://www.foo.com",
config={"version": util.API_VERSION_2, "token": "token"},
)
client.post_request("endpoint", data=json.dumps({"foo": "bar"}))
self.assertEqual(responses.calls[0].request.body, '{"foo": "bar"}')
expected_headers = {
"Authorization": "Bearer token",
"Content-Type": "application/json",
}
actual_headers = responses.calls[0].request.headers
self.assertTrue(
set(expected_headers.items()).issubset(set(actual_headers.items()))
)
def setUp(self):
self.component = components.recording.RecordingComponentV2(
base_uri="http://foo.com",
config={
"api_key": "KEY",
"api_secret": "SECRET",
"version": util.API_VERSION_2,
},
must include all of the config data, this method ensures that all
of that data is there
:param endpoint: The endpoint
:param params: The URL parameters
:param data: The data (either as a dict or dumped JSON string) to
include with the POST
:param headers: request headers
:param cookies: request cookies
:return: The :class:``requests.Response`` object for this request
"""
params = params or {}
if self.config["version"] == util.API_VERSION_1:
params.update(self.config)
del params["version"]
if headers is None and self.config.get("version") == util.API_VERSION_2:
headers = {
"Authorization": "Bearer {}".format(self.config.get("token")),
"Content-Type": "application/json",
}
return super(BaseComponent, self).post_request(
endpoint, params=params, data=data, headers=headers, cookies=cookies
)
"""Zoom.us REST API Python Client"""
from __future__ import absolute_import, unicode_literals
from zoomus import components, util
from zoomus.util import API_VERSION_1, API_VERSION_2
API_BASE_URIS = {
API_VERSION_1: "https://api.zoom.us/v1",
API_VERSION_2: "https://api.zoom.us/v2",
}
COMPONENT_CLASSES = {
API_VERSION_1: {
"user": components.user.UserComponent,
"meeting": components.meeting.MeetingComponent,
"report": components.report.ReportComponent,
"webinar": components.webinar.WebinarComponent,
"recording": components.recording.RecordingComponent,
},
API_VERSION_2: {
"user": components.user.UserComponentV2,
"meeting": components.meeting.MeetingComponentV2,
"metric": components.metric.MetricComponentV2,
"past_meeting": components.past_meeting.PastMeetingComponentV2,
"report": components.report.ReportComponentV2,