Saturday, September 09, 2017

"No connection adapters were found for '%s'" % url [Solved]


Error:


Traceback (most recent call last):

  File "C:\Users\310211146\AppData\Local\Continuum\Anaconda3\lib\site-packages\requests\api.py", line 110, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "C:\Users\310211146\AppData\Local\Continuum\Anaconda3\lib\site-packages\requests\api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Users\310211146\AppData\Local\Continuum\Anaconda3\lib\site-packages\requests\sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\310211146\AppData\Local\Continuum\Anaconda3\lib\site-packages\requests\sessions.py", line 590, in send
    adapter = self.get_adapter(url=request.url)
  File "C:\Users\310211146\AppData\Local\Continuum\Anaconda3\lib\site-packages\requests\sessions.py", line 672, in get_adapter
    raise InvalidSchema("No connection adapters were found for '%s'" % url)
requests.exceptions.InvalidSchema: No connection adapters were found for 'localhost:8080/'


Problem Code:

resp = requests.post("localhost:8080", auth=("user","pass"), headers={"key":"value"}) 


Solution:

resp = requests.post("http://localhost:8080", auth=("user","pass"), headers={"key":"value"}) 


Reference: https://stackoverflow.com/a/15115345/4064166

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.