Not able to create new user in python using api

Drew Adorno
I am trying to create a user in Python using the https://www.cometchat.com/docs/chat-apis/ref#creates-user guide
 
The example they have for Python doesn't seem to be syntactically correct as Python complains about it. 
 
I tried a few different variations but am just getting back failed to establish a new connection errors
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='2405769c74dbd42b.us.cometchat.io', port=443): Max retries exceeded with url: /v3/users (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000002116DF76590>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))
 
I assumed that my appID and app region should be filled in the URL even though there was no indication of the case in the documentation

Here is the code I tried

import requests

headers = {
    'apiKey': '8b2958ea5f3fac9183f18ea8410e92164f2f6281',
    'Content-Type': 'application/json',
    'Accept': 'application/json',
}

payload = {
    'uid': 166,
    'name': 'Drew Adorno',
}

requests.post('https://2405769c74dbd42b.us.cometchat.io/v3/users', headers=headers, data=payload)

Replies

0 comments

Please sign in to leave a comment.