Hi, yes, i am still receiving the error 400.
The only response i receive from the server is:
<Response [400]> '<html></html>'
i will include the results of a capture of the petition using HTTPToolkit to visualize the details:
Request:
METHOD: GET
HEADERS
Accept:/
Accept-Encoding:gzip, deflate
Authorization:Bearer eyJzdiI6IjAwMDAw**********
Connection:keep-alive
Cookie:__cf_bm=JOQ4udkx*******; _zm_ctaid=9wSFZAXiTX********; _zm_mtk_guid=dfdf8*******; _zm_page_auth=aw1_c_Z6******; _zm_ssid=aw1_c_HZo********; cred=3A4266B2*****
Host:fileapi.zoom.us
User-Agent:python-requests/2.32.3
Response:
STATUS: 400 Bad Request
HEADERS
Connection:close
Content-Length:13
Content-Type:text/plain; charset=utf-8
Date:Wed, 16 Apr 2025 14:45:00 GMT
Response body
<html></html>
and i will also add the exact code i am using:
import asyncio
import requests
import base64
import os
import datetime
import logging
from pprint import pprint
class Manager:
def __init__(self):
self.access_token = None
self.session = requests.Session()
def get_zoom_access_token(self):
"""Generate a Zoom access token using account_credentials grant type"""
# Get credentials from environment variables
account_id = os.getenv("ZOOM_ACCOUNT_ID")
client_id = os.getenv("ZOOM_CLIENT_ID")
client_secret = os.getenv("ZOOM_CLIENT_SECRET")
# Check if credentials are available
if not all([account_id, client_id, client_secret]):
raise ValueError("Zoom API credentials not found in environment variables")
# Encode client_id and client_secret in base64
credentials = f"{client_id}:{client_secret}"
encoded_credentials = base64.b64encode(credentials.encode()).decode()
# Set up request headers
headers = {
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": f"Basic {encoded_credentials}"
}
# Set up request body
data = {
"grant_type": "account_credentials",
"account_id": account_id
}
# Make the request to get the access token
response = self.session.post("https://zoom.us/oauth/token", headers=headers, data=data)
# Check if the request was successful
if response.status_code == 200:
token_data = response.json()
self.access_token = {
"token": token_data["access_token"],
"created_at": datetime.datetime.now()
}
print(f"Zoom access token created.")
return self.access_token
else:
error_message = f"Failed to get Zoom access token: {response.status_code} - {response.text}"
print(error_message)
raise Exception(error_message)
def get_clips(self):
url = "https://fileapi.zoom.us/v2/clips"
querystring = {"user_id":"me"}
headers = {"Authorization": f"Bearer {self.access_token['token']}"}
# proxy = "http://127.0.0.1:8000"
proxy = None
# response = self.session.get(url, headers=headers, params=querystring, proxies={"http": proxy, "https": proxy}, verify=False)
response = self.session.get(url, headers=headers, params=querystring)
print("Status Code:")
print(response.status_code)
print("Response:")
print(response)
# pprint(response.json())
print(response.text)
if __name__ == "__main__":
manager = Manager()
manager.get_zoom_access_token()
manager.get_clips()
Thanks in advance