Error in request, cache key - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Error in request, cache key (/thread-17207.html) |
Error in request, cache key - a21250450 - Apr-02-2019
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, contentHello, someone can help me with these errors, I'm trying to make the orders with the postman? Thanks RE: Error in request, cache key - Larz60+ - Apr-02-2019 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? RE: Error in request, cache key - a21250450 - Apr-02-2019 (Apr-02-2019, 09:25 AM)a21250450 Wrote:Hello, someone can help me with these errors, I'm trying to make the orders with the postman? |