zoom_api_helper package¶
Submodules¶
zoom_api_helper.constants module¶
Project-specific constant values.
zoom_api_helper.log module¶
zoom_api_helper.models module¶
zoom_api_helper.oauth module¶
- zoom_api_helper.oauth.get_access_token(session: Session, account_id: str, client_id: str, client_secret: str) str [source]¶
Retrieve an access token, given credentials for a Server-to-Server OAuth app.
To use account credentials to get an access token for your app, call the Zoom OAuth token API with the account_credentials grant_type and your account_id.
The successful response will be the access token, which is a Bearer token type that expires in an hour, with the scopes that you chose in your app settings screen.
- Parameters
session – (Optional) Requests Session
account_id – Zoom Account ID
client_id – OAuth app Client ID
client_secret – OAuth app Client Secret
- Returns
The access token for the app.
zoom_api_helper.utils module¶
- class zoom_api_helper.utils.CustomEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]¶
Bases:
JSONEncoder
- default(o: Any) Any [source]¶
Implement this method in a subclass such that it returns a serializable object for
o
, or calls the base implementation (to raise aTypeError
).For example, to support arbitrary iterators, you could implement default like this:
def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o)
- class zoom_api_helper.utils.cached_property(func: Callable[[Any], _T])[source]¶
Bases:
object
Cached property implementation.
Transform a method of a class into a property whose value is computed once and then cached as a normal attribute for the life of the instance. Similar to property(), with the addition of caching. Useful for expensive computed properties of instances that are otherwise effectively immutable.
zoom_api_helper.v2 module¶
- class zoom_api_helper.v2.ZoomAPI(client_id: str, client_secret: str, account_id: Optional[str] = None, local=False)[source]¶
Bases:
object
Helper client to interact with the Zoom API v2
- bulk_create_meetings(col_header_to_kwarg: dict[str, str] = None, *, rows: list[RowType] = None, excel_file: str | os.PathLike[str] = None, max_threads=10, process_row: ProcessRow = None, update_row: UpdateRow = None, out_file: str | os.PathLike[str] = None, default_timezone='UTC', dry_run=False)[source]¶
POST /users/{userId}/meetings
: Use this API to bulk-create meetings, given a list of meetings to create.If the rows containing meetings to create lives in an Excel (.xlsx) file, then excel_file must be passed in, and contain the filepath of the Excel file to retrieve the meeting details from; else, rows must be passed in with a list of meetings to create.
Note that to read from Excel, the
sheet2dict
library is required; this can be installed easily via:$ pip install zoom-api-helper[excel]
col_header_to_kwarg
is a mapping of column headers to keyword arguments, as accepted by thecreate_meeting()
method. If the header names are all title-cased versions of the keyword arguments, then this argument does not need to be passed in. See also,constants.CREATE_MEETING_KWARGS
for a full list of acceptable keywords for the Create Meeting API; note that these are specified as values in the key-value pairing.process_row
is an optional function or callable that will be called with a copy of each row, or individual meeting info. The function can modify the row in place as desired.update_row
is an optional function or callable that will be called with the HTTP response data from the Create Meetings API, and the associated row from the Excel file. The function can modify the row in place as desired.If
dry_run
is enabled, then no API calls will be made, and this function will essentially be a no-op; however, useful logging output is printed for debugging purposes. Enable this parameter along with thesetup_logging()
helper function, in a debug environment.How It Works
This function scans in a list of rows containing a list of meetings to create, either from a local file or from the
rows
parameter. Then, it callsprocess_row
on each row, and also retrieves a mapping of column name to keyword argument viacol_header_to_kwarg
. Then, it concurrently creates a list of meetings via the Zoom Create Meetings API. Finally, it callsupdate_row
on each response and row pair, and writes out the updated meeting info to an output CSV file namedout_file
, which defaults to{excel-file-name-without-ext}}.out.csv
if an output filepath is not specified.References
- API documentation:
If a naive datetime object is provided for
start_time
or any other field (i.e. one with no timezone information) the value fortimezone
will determine which timezone to associate with the datetime object - defaults to UTC time if not specified.- For a list of supported timezones, please see:
- create_meeting(*, session: requests.Session | None = None, host_id: str | None = None, host_email: str | None = None, topic: str = 'My Meeting', agenda: str = 'My Description', start_time: datetime | str | None = None, timezone: str | None = 'UTC', type: Meeting | None = None, **request_data) dict[str, Any] [source]¶
POST /users/{userId}/meetings
: Use this API to create a meeting for a user.If a naive datetime object is provided for start_time or any other field (i.e. one with no timezone information) the value for`timezone` will determine which timezone to associate with the datetime object - defaults to UTC time if not specified.
- For a list of supported timezones, please see:
- Returns
- list_users(status: str | None = 'active', page_size=300, page=1, all_pages=True)[source]¶
GET /users
: Use this API to list your account’s users.- Parameters
status – The user’s status, one of: active, inactive, pending
page_size – The number of records returned within a single API call.
page – The page number of the current page in the returned records.
all_pages – True to paginate and retrieve all records (pages).
- Returns
A dict object, where the users key contains a list of users.
Module contents¶
Zoom API Helper¶
Utilities to interact with the Zoom API v2
Sample Usage:
>>> import zoom_api_helper
For full documentation and more advanced usage, please see <https://zoom-api-helper.readthedocs.io>.
- copyright
2022 by Ritvik Nag.
- license
MIT, see LICENSE for more details.
- class zoom_api_helper.ZoomAPI(client_id: str, client_secret: str, account_id: Optional[str] = None, local=False)[source]¶
Bases:
object
Helper client to interact with the Zoom API v2
- bulk_create_meetings(col_header_to_kwarg: dict[str, str] = None, *, rows: list[RowType] = None, excel_file: str | os.PathLike[str] = None, max_threads=10, process_row: ProcessRow = None, update_row: UpdateRow = None, out_file: str | os.PathLike[str] = None, default_timezone='UTC', dry_run=False)[source]¶
POST /users/{userId}/meetings
: Use this API to bulk-create meetings, given a list of meetings to create.If the rows containing meetings to create lives in an Excel (.xlsx) file, then excel_file must be passed in, and contain the filepath of the Excel file to retrieve the meeting details from; else, rows must be passed in with a list of meetings to create.
Note that to read from Excel, the
sheet2dict
library is required; this can be installed easily via:$ pip install zoom-api-helper[excel]
col_header_to_kwarg
is a mapping of column headers to keyword arguments, as accepted by thecreate_meeting()
method. If the header names are all title-cased versions of the keyword arguments, then this argument does not need to be passed in. See also,constants.CREATE_MEETING_KWARGS
for a full list of acceptable keywords for the Create Meeting API; note that these are specified as values in the key-value pairing.process_row
is an optional function or callable that will be called with a copy of each row, or individual meeting info. The function can modify the row in place as desired.update_row
is an optional function or callable that will be called with the HTTP response data from the Create Meetings API, and the associated row from the Excel file. The function can modify the row in place as desired.If
dry_run
is enabled, then no API calls will be made, and this function will essentially be a no-op; however, useful logging output is printed for debugging purposes. Enable this parameter along with thesetup_logging()
helper function, in a debug environment.How It Works
This function scans in a list of rows containing a list of meetings to create, either from a local file or from the
rows
parameter. Then, it callsprocess_row
on each row, and also retrieves a mapping of column name to keyword argument viacol_header_to_kwarg
. Then, it concurrently creates a list of meetings via the Zoom Create Meetings API. Finally, it callsupdate_row
on each response and row pair, and writes out the updated meeting info to an output CSV file namedout_file
, which defaults to{excel-file-name-without-ext}}.out.csv
if an output filepath is not specified.References
- API documentation:
If a naive datetime object is provided for
start_time
or any other field (i.e. one with no timezone information) the value fortimezone
will determine which timezone to associate with the datetime object - defaults to UTC time if not specified.- For a list of supported timezones, please see:
- create_meeting(*, session: requests.Session | None = None, host_id: str | None = None, host_email: str | None = None, topic: str = 'My Meeting', agenda: str = 'My Description', start_time: datetime | str | None = None, timezone: str | None = 'UTC', type: Meeting | None = None, **request_data) dict[str, Any] [source]¶
POST /users/{userId}/meetings
: Use this API to create a meeting for a user.If a naive datetime object is provided for start_time or any other field (i.e. one with no timezone information) the value for`timezone` will determine which timezone to associate with the datetime object - defaults to UTC time if not specified.
- For a list of supported timezones, please see:
- Returns
- list_users(status: str | None = 'active', page_size=300, page=1, all_pages=True)[source]¶
GET /users
: Use this API to list your account’s users.- Parameters
status – The user’s status, one of: active, inactive, pending
page_size – The number of records returned within a single API call.
page – The page number of the current page in the returned records.
all_pages – True to paginate and retrieve all records (pages).
- Returns
A dict object, where the users key contains a list of users.