500 error POST/users/[userID]/picture python requests

I have written a bunch of successful api requests for managing my High School’s recordings, but we wanted to remove all student’s profile pictures/set them all to a default. I copied my interface function template, and made all the right changes and tried to make the call. I get a 500 error. I’ve changed almost all parts of my function, including copying the sample code from the API page. Not exactly sure what’s going on here.

<Response [500]>
response.text gives HTML for a webpage displaying “Internal Service Error”

Which App Type (OAuth / Chatbot / JWT / Webhook)?
JWT, I can send other requests so I’m pretty sure it’s not this.

Which Endpoint/s?

My Code:
def postUserProfilePicture(API_KEY, API_SECRET, userID):
----headers = {‘authorization’: ‘Bearer %s’ % generateToken(API_KEY, API_SECRET),
-------------------‘content-type’: ‘multipart/form-data’}
----file = {“pic_file”: open(“kennedySeal.png”, ‘rb’)}
----res = requests.post(“https://api.zoom.us/v2/users/” + userID + “/picture”, headers=headers, files=file)

Hi @zachary.burnaby,

Happy Friday.

Please use this code logic to use the profile picture API in python:

import requests
url = "https://api.zoom.us/v2/users/userID/picture"
img_path = ''

headers = {'Authorization': 'Bearer Token',
           'Accept': 'application/json',
files = {'pic_file': (img_path.split('/')[-1], open(img_path, 'rb'), 'image/png')}

response = requests.post(url, files=files, headers=headers)
print response.content 

Let me know if this helps.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.