def get_users():
    if meeting_json_exists("users"):
        return read_meeting_json("users")

    else:
        params = {"status": "active", "page_size": 30, "page_number": 1}
        users = _get("/users", params)["users"]
        save_meeting_json("users", users)
        return users
Esempio n. 2
0
def create_or_update_meeting(
	unique_id, user_email, topic, start_time, password,
	duration, waiting_room):

	if len(password) > 10:
		raise ValueError("password length must be <10")

	if meeting_json_exists(unique_id):
		meeting_id = read_meeting_json(unique_id)['id']
		settings = {
			"topic": topic,
			"start_time": start_time,
			"password": password,
			"duration": duration,
			"settings": {
				"join_before_host": not waiting_room,
				"waiting_room": waiting_room
			}
		}
		_patch("/meetings/{}".format(meeting_id), json=settings)
		meeting = _get("/meetings/{}".format(meeting_id))

	else:
		settings = {
			"topic": topic,
			"type": 2,  # scheduled meeting
			"start_time": start_time,
			"duration": duration,
			"password": password,
			"settings": {
				"host_video": True,
				"participant_video": False,
				"join_before_host": not waiting_room,
				"mute_upon_entry": True,
				"watermark": False,
				"use_pmi": False,
				"approval_type": 2,
				"audio": "both",
				"auto_recording": "none",
				"waiting_room": waiting_room,
				"meeting_authentication": True,
			}
		}

		user = find_user(user_email)
		url = "/users/{}/meetings".format(user["id"])
		meeting = _post(url, json=settings)

	save_meeting_json(unique_id, meeting)
	return meeting