Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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")
kwargs["from"] = util.date_to_str(start)
end = kwargs.pop("end", None)
if end:
kwargs["to"] = util.date_to_str(end)
return self.post_request("/recording/list", params=kwargs)
def delete(self, **kwargs):
util.require_keys(kwargs, ["meeting_id"])
return self.post_request("/recording/delete", params=kwargs)
def get(self, **kwargs):
util.require_keys(kwargs, ["meeting_id"])
return self.post_request("/recording/get", params=kwargs)
class RecordingComponentV2(base.BaseComponent):
"""Component dealing with all recording related matters"""
def list(self, **kwargs):
util.require_keys(kwargs, "user_id")
start = kwargs.pop("start", None)
if start:
kwargs["from"] = util.date_to_str(start)
end = kwargs.pop("end", None)
if end:
kwargs["to"] = util.date_to_str(end)
return self.get_request(
"/users/{}/recordings".format(kwargs.get("user_id")), params=kwargs
)
def get(self, **kwargs):
util.require_keys(kwargs, "meeting_id")
"""Zoom.us REST API Python Client -- Recording component"""
from zoomus import util
from zoomus.components import base
class RecordingComponent(base.BaseComponent):
"""Component dealing with all recording related matters"""
def list(self, **kwargs):
util.require_keys(kwargs, "host_id")
start = kwargs.pop("start", None)
if start:
kwargs["from"] = util.date_to_str(start)
end = kwargs.pop("end", None)
if end:
kwargs["to"] = util.date_to_str(end)
return self.post_request("/recording/list", params=kwargs)
def delete(self, **kwargs):
util.require_keys(kwargs, ["meeting_id"])
return self.post_request("/recording/delete", params=kwargs)
def end(self, **kwargs):
util.require_keys(kwargs, ["id", "host_id"])
return self.post_request("/webinar/end", params=kwargs)
def get(self, **kwargs):
util.require_keys(kwargs, ["id", "host_id"])
return self.post_request("/webinar/get", params=kwargs)
def register(self, **kwargs):
util.require_keys(kwargs, ["id", "email", "first_name", "last_name"])
if kwargs.get("start_time"):
kwargs["start_time"] = util.date_to_str(kwargs["start_time"])
return self.post_request("/webinar/register", params=kwargs)
class WebinarComponentV2(base.BaseComponent):
"""Component dealing with all webinar related matters"""
def list(self, **kwargs):
util.require_keys(kwargs, "user_id")
return self.get_request(
"/users/{}/webinars".format(kwargs.get("user_id")), params=kwargs
)
def create(self, **kwargs):
util.require_keys(kwargs, "user_id")
return self.post_request(
"/users/{}/webinars".format(kwargs.get("user_id")), params=kwargs
)
def update(self, **kwargs):
util.require_keys(kwargs, "id")
"""Zoom.us REST API Python Client"""
from __future__ import absolute_import
from zoomus import util
from zoomus.components import base
class MeetingComponent(base.BaseComponent):
"""Component dealing with all meeting related matters"""
def list(self, **kwargs):
util.require_keys(kwargs, "host_id")
if kwargs.get("start_time"):
kwargs["start_time"] = util.date_to_str(kwargs["start_time"])
return self.post_request("/meeting/list", params=kwargs)
def create(self, **kwargs):
util.require_keys(kwargs, ["host_id", "topic", "type"])
if kwargs.get("start_time"):
kwargs["start_time"] = util.date_to_str(kwargs["start_time"])
return self.post_request("/meeting/create", params=kwargs)
def update(self, **kwargs):
util.require_keys(kwargs, ["id", "host_id"])
return self.post_request("/user/delete", params=kwargs)
def cust_create(self, **kwargs):
util.require_keys(kwargs, ["type", "email"])
return self.post_request("/user/custcreate", params=kwargs)
def get(self, **kwargs):
util.require_keys(kwargs, "id")
return self.post_request("/user/get", params=kwargs)
def get_by_email(self, **kwargs):
util.require_keys(kwargs, ["email", "login_type"])
return self.post_request("/user/getbyemail", params=kwargs)
class UserComponentV2(base.BaseComponent):
def list(self, **kwargs):
return self.get_request("/users", params=kwargs)
def create(self, **kwargs):
return self.post_request("/users", data=kwargs)
def update(self, **kwargs):
util.require_keys(kwargs, "id")
return self.patch_request("/users/{}".format(kwargs.get("id")), data=kwargs)
def delete(self, **kwargs):
util.require_keys(kwargs, "id")
return self.delete_request("/users/{}".format(kwargs.get("id")), params=kwargs)
def get(self, **kwargs):
util.require_keys(kwargs, "id")
"""Zoom.us REST API Python Client -- Webinar component"""
from __future__ import absolute_import
from zoomus import util
from zoomus.components import base
class WebinarComponent(base.BaseComponent):
"""Component dealing with all webinar related matters"""
def list(self, **kwargs):
util.require_keys(kwargs, "host_id")
if kwargs.get("start_time"):
kwargs["start_time"] = util.date_to_str(kwargs["start_time"])
return self.post_request("/webinar/list", params=kwargs)
def upcoming(self, **kwargs):
util.require_keys(kwargs, "host_id")
if kwargs.get("start_time"):
kwargs["start_time"] = util.date_to_str(kwargs["start_time"])
return self.post_request("/webinar/list/registration", params=kwargs)
def create(self, **kwargs):
util.require_keys(kwargs, ["host_id", "topic"])
"""Zoom.us REST API Python Client -- User component"""
from __future__ import absolute_import
from zoomus import util
from zoomus.components import base
class UserComponent(base.BaseComponent):
"""Component dealing with all user related matters"""
def list(self, **kwargs):
return self.post_request("/user/list", params=kwargs)
def pending(self, **kwargs):
return self.post_request("/user/pending", params=kwargs)
def create(self, **kwargs):
return self.post_request("/user/create", params=kwargs)
def update(self, **kwargs):
util.require_keys(kwargs, "id")
return self.post_request("/user/update", params=kwargs)
def delete(self, **kwargs):
return self.post_request("/report/getaccountreport", params=kwargs)
def get_user_report(self, **kwargs):
util.require_keys(kwargs, ["start_time", "end_time"], kwargs)
kwargs["from"] = util.date_to_str(kwargs["start_time"])
del kwargs["start_time"]
kwargs["to"] = util.date_to_str(kwargs["end_time"])
del kwargs["end_time"]
return self.post_request("/report/getuserreport", params=kwargs)
def get_daily_report(self, **kwargs):
util.require_keys(kwargs, ["month", "year"], kwargs)
return self.post_request("/report/getdailyreport", params=kwargs)
class ReportComponentV2(base.BaseComponent):
def get_user_report(self, **kwargs):
util.require_keys(kwargs, ["user_id", "start_time", "end_time"])
kwargs["from"] = util.date_to_str(kwargs["start_time"])
del kwargs["start_time"]
kwargs["to"] = util.date_to_str(kwargs["end_time"])
del kwargs["end_time"]
return self.get_request(
"/report/users/{}/meetings".format(kwargs.get("user_id")), params=kwargs
)
def get_account_report(self, **kwargs):
util.require_keys(kwargs, ["start_time", "end_time"])
kwargs["from"] = util.date_to_str(kwargs["start_time"])
del kwargs["start_time"]
kwargs["to"] = util.date_to_str(kwargs["end_time"])
del kwargs["end_time"]