mirror of https://github.com/zulip/zulip.git
25 lines
686 B
Python
25 lines
686 B
Python
import requests
|
|
import jwt
|
|
from typing import Any, Dict, Optional
|
|
import time
|
|
|
|
def request_zoom_video_call_url(user_id: str, api_key: str, api_secret: str) -> Optional[Dict[str, Any]]:
|
|
encodedToken = jwt.encode({
|
|
'iss': api_key,
|
|
'exp': int(round(time.time() * 1000)) + 5000
|
|
}, api_secret, algorithm='HS256').decode('utf-8')
|
|
|
|
response = requests.post(
|
|
'https://api.zoom.us/v2/users/' + user_id + '/meetings',
|
|
headers = {
|
|
'Authorization': 'Bearer ' + encodedToken,
|
|
'content-type': 'application/json'
|
|
},
|
|
json = {}
|
|
)
|
|
|
|
if response.status_code != 200:
|
|
return None
|
|
|
|
return response.json()
|