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

Example for user.update() method #61

Open
xezpeleta opened this issue Mar 27, 2020 · 2 comments
Open

Example for user.update() method #61

xezpeleta opened this issue Mar 27, 2020 · 2 comments

Comments

@xezpeleta
Copy link

Hi!

First of all, thanks for your great project!

I'd like to update the user type (basic, licensed) based on the scheduled meetings. Do you have any working example for the client.user.update(...) method?

Thanks!

@prschmid
Copy link
Owner

Hi @xezpeleta, I unfortunately don't have an example for this explicitly, but under the hood all these methods do is GET, POST, PATCH, DELETE the objects based on Zoom's REST API.

When you do get it working, can you post your example here. I will start an examples directory in the near future and we can add all of those in there.

Thank you for using the library and I wish you all the best!

@xezpeleta
Copy link
Author

When you do get it working, can you post your example here. I will start an examples directory in the near future and we can add all of those in there.

'''
The following code changes the user type, from non licensed to licensed
'''

USER_NON_LICENSED = 1
USER_LICENSED = 2

client = ZoomClient(API_KEY, API_SECRET)
users = json.loads(client.user.list().content)['users']
for user in users:
    if user['type'] == USER_NON_LICENSED:
        user_data = {
            "id": user['id'],
            "type": USER_LICENSED
        }
        response = client.user.update(**user_data)
        if response.status_code == 204:
            print("User %s is now licensed" % user['email'])
        else:
            print("ERROR: cannot change the user. More info: {}".format(response.text))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants