Output:
Traceback (most recent call last):
File "C:\XXXX\Genesys-Flask.py", line 28, in
Authenicate()
File "C:\XXXX\Genesys-Flask.py", line 19, in Authenicate
os.environ['Genesys_Client'],
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 679, in getitem
KeyError: 'Genesys_Client'
Your environment variable names are most likely incorrect, I was able to replicate this by using environment variable that did not exist on my machine. The function works correctly for me with environment variables that exist.
As far as I know there's no ports involved. I don't think this is a problem with our code but I could be wrong. It's possible that even though the environment variable exists on your machine but your code can't access it. Try do a check to see if your code knows about the environment variables before you try to access them. Something like this:
if environment_variable_name in os.environ:
print(f"The environment variable exists.")
else:
print(f"The environment variable does not exist.")
The issue is not with your OAuth credentials or the Developer roles. Your python code can't find the environment variables that you are trying to access. The code sample I gave checks to see if your environment variables exist before it tries to access them. If the exception is being thrown it means the environment variables are not set or python can't find them for some reason.
This means that authentication has failed and your client ID and/or secret are not valid in the region to which you're connecting. That means either you have a bug in your code, a typo in your id or secret, or you're using credentials from a different region. Your code example doesn't show setting the region, so if you're in a region other that us-east-1 (mypurecloud.com), you need to set it.