I'm trying to do something really simple. I'm just requesting an OAuth2 token from an endpoint, it's a very simple function:
def __get_access_token():
response = requests.post(
token_url,
data={"grant_type": "client_credentials"},
auth={client_id, client_secret}
)
return response.json()["access_token"]
However when I run it I get the exception (assume that token_url, client_id and client_secret are real values when executing):
Traceback (most recent call last):
File "/home/x/.cache/JetBrains/RemoteDev/dist/8cfe3c6ce165d_pycharm-professional-2024.2.1/plugins/python-ce/helpers/pydev/pydevd.py", line 1557, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
File "/home/x/PycharmProjects/wiiWeight/venv/lib/python3.12/site-packages/requests/models.py", line 602, in prepare_auth
r = auth(self)
^^^^^^^^^^
TypeError: 'set' object is not callable
What exactly am I doing wrong here? I can't figure it out myself.
I'm running Python 3.12