Legacy Dev Forum Posts

 View Only

Sign Up

Get_client_credentials_token freeze

  • 1.  Get_client_credentials_token freeze

    Posted 06-05-2025 18:09

    gilles.paquet | 2024-04-26 13:45:16 UTC | #1

    Hello,

    When I execute a simple script getting the list of queues available, it freezes when authenticating using the following code :

    apiclient = PureCloudPlatformClientV2.apiclient.ApiClient().getclientcredentialstoken('xxxxx','yyyyy')

    The very same script works from my azure test server, but freeze from my prod server on-prem.

    I got the following when interrupting the script :

    ^CTraceback (most recent call last):
      File "./getQueuesDetails.py", line 10, in <module>
        apiclient = PureCloudPlatformClientV2.api_client.ApiClient().get_client_credentials_token('xxxxx','yyyyy')
      File "/usr/local/lib/python3.6/site-packages/PureCloudPlatformClientV2/api_client.py", line 131, in get_client_credentials_token
        post_params=post_params, body=body);
      File "/usr/local/lib/python3.6/site-packages/PureCloudPlatformClientV2/api_client.py", line 631, in request
        body=body)
      File "/usr/local/lib/python3.6/site-packages/PureCloudPlatformClientV2/rest.py", line 229, in POST
        body=body)
      File "/usr/local/lib/python3.6/site-packages/PureCloudPlatformClientV2/rest.py", line 171, in request
        headers=headers)
      File "/usr/lib/python3.6/site-packages/urllib3/request.py", line 72, in request
        **urlopen_kw)
      File "/usr/lib/python3.6/site-packages/urllib3/request.py", line 150, in request_encode_body
        return self.urlopen(method, url, **extra_kw)
      File "/usr/lib/python3.6/site-packages/urllib3/poolmanager.py", line 324, in urlopen
        response = conn.urlopen(method, u.request_uri, **kw)
      File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
        chunked=chunked)
      File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 343, in _make_request
        self._validate_conn(conn)
      File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 839, in _validate_conn
        conn.connect()
      File "/usr/lib/python3.6/site-packages/urllib3/connection.py", line 315, in connect
        conn = self._new_conn()
      File "/usr/lib/python3.6/site-packages/urllib3/connection.py", line 162, in _new_conn
        (self._dns_host, self.port), self.timeout, **extra_kw)
      File "/usr/lib/python3.6/site-packages/urllib3/util/connection.py", line 70, in create_connection
        sock.connect(sa)
    KeyboardInterrupt

    I have tried waiting for a long time, but it never ends up in timeout.

    Hereafter the script I used:

    import PureCloudPlatformClientV2
    from PureCloudPlatformClientV2.rest import ApiException
    
    region = PureCloudPlatformClientV2.PureCloudRegionHosts.eu_central_1
    PureCloudPlatformClientV2.configuration.host = region.get_api_host()
    print (PureCloudPlatformClientV2.configuration.host)
    apiclient = PureCloudPlatformClientV2.api_client.ApiClient().get_client_credentials_token('xxxxx','yyyyy')
    api_instance = PureCloudPlatformClientV2.RoutingApi(apiclient)
    # Get list of queues
    api_response = api_instance.get_routing_queues()
    print(api_response)

    There is no network restriction, except that I'm going outside through a proxy. The hosts are the same (RHEL 8), Python version are the same 3.6. SeLinux is disabled.

    Any clue where I should look to troubleshoot that problem?

    Thanks a lot.

    Gilles.


    Jerome.Saint-Marc | 2024-04-26 14:07:38 UTC | #2

    Hello,

    You can set the address of the proxy server in the SDK if you are connecting through a proxy server. See Connect to a Proxy Server - Platform API Python SDK.

    Regards,


    gilles.paquet | 2024-04-26 14:20:49 UTC | #3

    It's supposed to be a transparent proxy, but your advice is the answer.

    Thanks a lot.

    Regards,

    Gilles.


    system | 2024-05-27 14:18:32 UTC | #4

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


    This post was migrated from the old Developer Forum.

    ref: 25943