import requests
import jwt
import time

ZOOM_API_KEY = 'OoDRW3uVTymEnnQWTZTsLQ'
ZOOM_API_SECRET = 'ZJ0hCFMrwekG71jbR3Trvoor4tK3HAVP'

def generate_zoom_jwt():
    payload = {
        'iss': ZOOM_API_KEY,
        'exp': time.time() + 3600
    }
    token = jwt.encode(payload, ZOOM_API_SECRET, algorithm='HS256')
    return token

def create_zoom_meeting(topic, start_time, duration, host_email):
    jwt_token = generate_zoom_jwt()
    headers = {
        'Authorization': f'Bearer {jwt_token}',
        'Content-Type': 'application/json'
    }
    data = {
        "topic": topic,
        "type": 2,
        "start_time": start_time,
        "duration": duration,
        "schedule_for": host_email,
        "settings": {"join_before_host": True}
    }
    url = f"https://api.zoom.us/v2/users/{host_email}/meetings"
    return requests.post(url, json=data, headers=headers)


if __name__ == "__main__":
    topic = "Your Meeting Topic"
    start_time = "2023-08-25T10:00:00"
    duration = 60
    host_email = "your_zoom_email"
    response = create_zoom_meeting(topic, start_time, duration, host_email)
    print(response.json())