Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a nice wrapper for zoomus #76

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Mr0grog
Copy link
Member

@Mr0grog Mr0grog commented Aug 31, 2024

I might be getting overcomplicated here. In #73, I added a bunch of error handling code for Zoom, but it felt kind of awkward. I reworked that here into a FancyZoom class. You use it just like zoomus.ZoomClient, except the API calls return parsed data on success and raise exceptions on error.

No need to explicitly parse:

# Previously:
zoom.user.get(id='abc123').json()['id']

# Now:
zoom.user.get(id='abc123')['id']

No need to check and handle error statuses with lots of extra conditions:

# Previously:
response = zoom.user.get(id='bad_id')
if response.status_code >= 400:
    # Do something indicating the error

# Now:
zoom.user.get(id='bad_id')  # raises `ZoomError` with a nice message

This also moves file downloading into the new class, since it makes more sense there.

@Mr0grog Mr0grog force-pushed the using-zoomus-safely-is-too-complicated branch from db8cdba to 7bd05a7 Compare August 31, 2024 02:47
@Mr0grog Mr0grog force-pushed the using-zoomus-safely-is-too-complicated branch from 7bd05a7 to 099154c Compare October 4, 2024 17:37
In a recent commit, I added a bunch of awkward error handling around zoomus. This makes it much cleaner to use. Just create an instance of `FancyZoom` instead of `ZoomClient` and API calls are automatically wrapped to return parsed data or raise exceptions as appropriate.
@Mr0grog Mr0grog force-pushed the using-zoomus-safely-is-too-complicated branch from 099154c to ffab293 Compare November 15, 2024 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant