Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error in request, cache key
#1
Error:
Traceback (most recent call last): File "/root/DNSaaS.py", line 497, in requestToken response, content = h.request(target.geturl(), 'POST', json.dumps(msgJson), headers) File "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py", line 2135, in request cachekey, File "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py", line 1796, in _request conn, request_uri, method, body, headers File "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py", line 1737, in _conn_request response = conn.getresponse() File "/usr/lib/python2.7/httplib.py", line 1108, in getresponse raise ResponseNotReady() ResponseNotReady
    def requestToken(self, user, password, tenant):
        """
        Method responsible ask for a token.

        :param user: User name
        :param password: Password
        :param tenant: Tenant name
        :rtype : object
        """
        headers = {
            'Accept': 'application/json',
            'Content-Type': 'application'
        }
        target = urlparse(self.__apiurlAAA)

        h = http.Http()
        msgJson = {"auth": {"tenantName": tenant, "passwordCredentials": {"username": user, "password": password}}}
        try:
            response, content = h.request(target.geturl(), 'POST', json.dumps(msgJson), headers)
        except:
            traceback.print_ex()
            return -1, "Server API not reachable,chega aqui "
        response_status = response.get("status")
        return response_status, content
Hello, someone can help me with these errors, I'm trying to make the orders with the postman?

Thanks
Reply
#2
Sounds like you're trying to reuse request from a socket that's already closed.
python 'requests' (not urllib or httplib) will get you past this.
Is this legacy code?
which version of python?
Reply
#3
(Apr-02-2019, 09:25 AM)a21250450 Wrote:
Error:
Traceback (most recent call last): File "/root/DNSaaS.py", line 497, in requestToken response, content = h.request(target.geturl(), 'POST', json.dumps(msgJson), headers) File "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py", line 2135, in request cachekey, File "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py", line 1796, in _request conn, request_uri, method, body, headers File "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py", line 1737, in _conn_request response = conn.getresponse() File "/usr/lib/python2.7/httplib.py", line 1108, in getresponse raise ResponseNotReady() ResponseNotReady
Hello, someone can help me with these errors, I'm trying to make the orders with the postman?

Thanks
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Speeding up code using cache Peter 1 1,327 Jul-29-2023, 04:52 AM
Last Post: bowlofred
  Opinion: how should my scripts cache web download files? stevendaprano 0 1,502 Dec-17-2022, 12:19 AM
Last Post: stevendaprano
  how can I correct the Bad Request error on my curl request tomtom 8 7,515 Oct-03-2021, 06:32 AM
Last Post: tomtom
  main libvlc error: stale plugins cache: schascheck 2 9,700 Dec-27-2020, 05:24 PM
Last Post: schascheck
  Clear Cache Path sportcardinal 0 2,264 Jul-05-2020, 05:11 PM
Last Post: sportcardinal
  Empty response to request causing .json() to error t4keheart 1 13,656 Jun-26-2020, 08:35 PM
Last Post: bowlofred
  ImportError: cannot import name 'Request' from 'request' abhishek81py 1 5,363 Jun-18-2020, 08:07 AM
Last Post: buran
  How to print cache from Decorators with Memoization OlgaM 2 2,822 Jan-29-2020, 05:06 PM
Last Post: OlgaM
  pip cache millpond 3 9,617 Jul-22-2019, 01:12 AM
Last Post: millpond
  python cache for small integer Uchikago 1 3,375 Jun-27-2019, 05:32 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020