Guest User

Zoom registration for meeting

a guest
Oct 3rd, 2017
1,331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.36 KB | None | 0 0
  1. import requests
  2.  
  3. zoom_base_url = 'https://api.zoom.us/v1'
  4. zoom_api_key = 'API_KEY'
  5. zoom_api_secret = 'API_SECRET'
  6.  
  7. credentials = {'api_key': zoom_api_key, 'api_secret': zoom_api_secret}
  8. meeting_data = {'type': 2, 'topic': 'test meeting', 'option_jbh': True, 'option_registration': True}
  9. registrant_data = {'email': '[email protected]', 'first_name': 'Test', 'last_name': 'User'}
  10.  
  11. # Retrieve users, take the first one as the host
  12.  
  13. response = requests.post(zoom_base_url + '/user/list', credentials)
  14. host = response.json()['users'][0]
  15.  
  16. host_id = host['id']
  17.  
  18. # print("Host: {}".format(host))
  19.  
  20. # Create meeting
  21.  
  22. data = meeting_data.copy()
  23. data.update({'host_id': host_id})
  24. data.update(credentials)
  25.  
  26. response = requests.post(zoom_base_url + '/meeting/create', data)
  27. meeting = response.json()
  28.  
  29. meeting_id = meeting['id']
  30. meeting_start_url = meeting['start_url']
  31.  
  32. # print("Meeting: {}".format(meeting))
  33.  
  34. # Register to meeting
  35.  
  36. data = registrant_data.copy()
  37. data.update({'id': meeting_id, 'host_id': host_id})
  38. data.update(credentials)
  39.  
  40. response = requests.post(zoom_base_url + '/meeting/register', data)
  41. registration = response.json()
  42.  
  43. # print("Registration: {}".format(registration))
  44.  
  45. registrant_join_url = registration['join_url']
  46.  
  47. print("Host start url: {}".format(meeting_start_url))
  48. print("Registrant join url: {}".format(registrant_join_url))
Advertisement
Add Comment
Please, Sign In to add comment