Hello all. I’m using requests 2.8.1 as part of a Flask 0.10.1 installation with Python 3.4 on Windows 8.1, and getting the following traceback upon attempting to run my code:
File "c:Python34atweatherlibsite-packagesrequests-2.8.1-py3.4.eggrequestsapi.py", line 69, in get return request('get', url, params=params, **kwargs)
File "c:Python34atweatherlibsite-packagesrequests-2.8.1-py3.4.eggrequestsapi.py", line 50, in request response = session.request(method=method, url=url, **kwargs)
File "c:Python34atweatherlibsite-packagesrequests-2.8.1-py3.4.eggrequestssessions.py", line 468, in request resp = self.send(prep, **send_kwargs)
File "c:Python34atweatherlibsite-packagesrequests-2.8.1-py3.4.eggrequestssessions.py", line 576, in send r = adapter.send(request, **kwargs)
File "c:Python34atweatherlibsite-packagesrequests-2.8.1-py3.4.eggrequestsadapters.py", line 423, in send raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='proxy.server', port=3128): Max retries exceeded with url: http://forecast.weather.gov/MapClick.php?lon=-84.2476&lat=34.5627&unit=0&lg=english&FcstType=text&TextType=1 (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x036F3830>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',)))
It’s not an issue with the url that I’m passing in, as the url works fine when I enter it directly into a browser tab — and moreover the same issue crops up with any url, for instance http://google.com.
My website is very simple and I’m just attempting to run it locally to do some development on it. I’m fairly new to using Flask and web programming in general, so if this seems more like something that I’m doing wrong with my Flask environment, directory structure, etc. then I apologize. Nothing has really changed about my project since the last time I did local development on it except for the versions of various packages that Flask uses.
Also…I chopped off everything in the traceback prior to when it started throwing «requests» stuff at me, but if you think any of what I excluded could be helpful then let me know. Thank you.
socket.gaierror: [Errno 11001] getaddrinfo failed #331
Comments
ghost commented Feb 16, 2017
Getting the below error on numerous samples. add_vswitch_to_host.py and dc_create.py that I’ve tried. Others (vcenter_details.py for example) work fine. Tried to add ssl.SSLContext, but no good. Full error:
Traceback (most recent call last):
File «dc_create.py», line 39, in
sslContext= context)
File «c:python33libsite-packagespyVimconnect.py», line 817, in SmartConnect
sslContext)
File «c:python33libsite-packagespyVimconnect.py», line 702, in __FindSupportedVersion
sslContext)
File «c:python33libsite-packagespyVimconnect.py», line 622, in __GetServiceVersionDescription
path + «/vimServiceVersions.xml», sslContext)
File «c:python33libsite-packagespyVimconnect.py», line 588, in __GetElementTree
conn.request(«GET», path)
File «c:python33libhttpclient.py», line 1106, in request
self._send_request(method, url, body, headers)
File «c:python33libhttpclient.py», line 1151, in _send_request
self.endheaders(body)
File «c:python33libhttpclient.py», line 1102, in endheaders
self._send_output(message_body)
File «c:python33libhttpclient.py», line 934, in _send_output
self.send(msg)
File «c:python33libhttpclient.py», line 877, in send
self.connect()
File «c:python33libhttpclient.py», line 1252, in connect
super().connect()
File «c:python33libhttpclient.py», line 849, in connect
(self.host,self.port), self.timeout, self.source_address)
File «c:python33libsocket.py», line 693, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File «c:python33libsocket.py», line 732, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed
The text was updated successfully, but these errors were encountered:
blacksponge commented Jul 13, 2017
The only times I have got the error I mistyped the host. I have just tested add_vswitch_to_host.py and I didn’t have any problem to perform the connection. Are you sure that the host was reachable and that you didn’t mistype it ?
akhilesh-agrhari commented Jul 10, 2018 •
@blacksponge, I am having the same error. Can you please suggest me a correct host
blacksponge commented Jul 10, 2018
@akhilesh-agrhari sorry but that was quite a while ago and I don’t have the possibilty of doing any kind of test now. I would say an ip or valid domain name.
bill-rheda commented Dec 11, 2018
I have the same error and i can assure you that my host name and port is correct. What can i do about this please?
funny000 commented Sep 7, 2020
Traceback (most recent call last):
File «D:/Propy/pythonProject_douyu/douyu.py», line 267, in
client = DouyuClient(‘openbarrage.douyutv.com’,8601,data_callback=data_callback)
File «D:/Propy/pythonProject_douyu/douyu.py», line 132, in init
self.connect(address)
File «C:UsersadainAppDataLocalProgramsPythonPython37libasyncore.py», line 333, in connect
err = self.socket.connect_ex(address)
socket.gaierror: [Errno 11001] getaddrinfo failed
funny000 commented Sep 7, 2020
Have anypeopel solve the problem?
markdibe commented Mar 22, 2021
I am encountering the same issue
Traceback (most recent call last):
File «/app/EmailSender/main.py», line 9, in
EmailSender(push_file_path=__path).send_message()
File «/app/EmailSender/EmailSender.py», line 25, in send_message
Email_Auth(push_mail=config, path_file=path_file).send_mail(file_names=files)
File «/app/EmailSender/EmailSender.py», line 79, in send_mail
self.generate_smtp(msg)
File «/app/EmailSender/EmailSender.py», line 103, in generate_smtp
smtp = smtplib.SMTP(self.server, self.port)
File «/usr/local/lib/python3.9/smtplib.py», line 253, in init
(code, msg) = self.connect(host, port)
File «/usr/local/lib/python3.9/smtplib.py», line 339, in connect
self.sock = self._get_socket(host, port, self.timeout)
File «/usr/local/lib/python3.9/smtplib.py», line 310, in _get_socket
return socket.create_connection((host, port), timeout,
File «/usr/local/lib/python3.9/socket.py», line 822, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File «/usr/local/lib/python3.9/socket.py», line 953, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
avinkr commented May 6, 2021
Traceback (most recent call last):
File «C:UserslenovoDesktopKeyloggerkeylogger.py», line 124, in
keylogger.run()
File «C:UserslenovoDesktopKeyloggerkeylogger.py», line 94, in run
self.report()
File «C:UserslenovoDesktopKeyloggerkeylogger.py», line 57, in report
self.send_mail(self.email, self.password, «nn» + self.log)
File «C:UserslenovoDesktopKeyloggerkeylogger.py», line 50, in send_mail
server = smtplib.SMTP(‘smtp.gmail.com’, 587, message.encode(«utf8»))
File «C:UserslenovoAppDataLocalProgramsPythonPython39libsmtplib.py», line 255, in init
(code, msg) = self.connect(host, port)
File «C:UserslenovoAppDataLocalProgramsPythonPython39libsmtplib.py», line 341, in connect
self.sock = self._get_socket(host, port, self.timeout)
File «C:UserslenovoAppDataLocalProgramsPythonPython39libsmtplib.py», line 312, in _get_socket
return socket.create_connection((host, port), timeout,
File «C:UserslenovoAppDataLocalProgramsPythonPython39libsocket.py», line 822, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File «C:UserslenovoAppDataLocalProgramsPythonPython39libsocket.py», line 953, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed
barisdnmz commented Jul 28, 2022
Traceback (most recent call last):
File «C:UsersEmiHPPycharmProjectssftp_downloadmain.py», line 6, in
transport=paramiko.Transport((host,port))
File «C:UsersEmiHPAppDataLocalProgramsPythonPython39libsite-packagesparamikotransport.py», line 426, in init
addrinfos = socket.getaddrinfo(
File «C:UsersEmiHPAppDataLocalProgramsPythonPython39libsocket.py», line 954, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed
barisdnmz commented Jul 28, 2022
make sure that the hostname is just hostname and not including any path in the hostname variable, that fixed my problem.
Источник
Fails to connect to redis, when running inside of docker container #763
Comments
mishushakov commented Dec 12, 2018
Hey, the library works like a charm, thanks a lot. My application is a microservice, which connects to a redis database, which is running inside of docker. However, I can not connect to redis, when my application is running inside of container. I can still connect to redis remotely via cli on other host and it clearly works. I can also run my application outside of docker (directly on my host machine) and it would still connect. But when I build and run the image, it says:
I also tried to provision my application to docker swarm with compose file on the same network as redis
But it still wouldn’t connect
Here is the code, I use in my application:
Thank you in advance.
The text was updated successfully, but these errors were encountered:
luin commented Dec 12, 2018
Have you tried connecting to Redis via host «redis» (see https://docs.docker.com/compose/networking/)?
mishushakov commented Dec 12, 2018
Hey, @luin thanks for quick reply, I will try it and comment back in the issue in a second. Thank you
mishushakov commented Dec 12, 2018
Still fails, but now with this error:
luin commented Dec 12, 2018
Will, that is a network problem and it should not be related to ioredis.
mishushakov commented Dec 12, 2018
Ok, then I will try to hack around on my docker machine. Thank you
hendrixroa commented Jan 3, 2019
@mishushakov Try delete the networks and replace redis section by:
That works for me.
aiyogg commented Sep 6, 2019
Same problem for me, it’s still exist I’ve tried all suggestions above. Who can help me to resolve this, please.
aiyogg commented Sep 6, 2019
Same problem for me, it’s still exist I’ve tried all suggestions above. Who can help me to resolve this, please.
It’s ok after I run docker-compose build then docker-compose up .
portinos commented Sep 8, 2019
@mishushakov Try delete the networks and replace redis section by:
Hey! How about running redis without docker-compose? I mean, running only the image. I lift the redis container using docker run —name redis.server -d -p 6379:6379 redis:latest but I can’t connect from Sails (Node.js) using redis.server as hostname; the response is ENOTFOUND. The docker container is the official: https://hub.docker.com/_/redis/
shanurrahman commented Nov 21, 2019
@mishushakov Try delete the networks and replace redis section by:
You saved me tonight
ravipam commented Nov 25, 2019
@mishushakov Try delete the networks and replace redis section by:
You saved me tonight
Unfortunately did not work for me.
I deleted the docker networks. do i need to delete any other network, if any , please guide me.
i still have the error: [ioredis] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:6379
Источник
socket.gaierror: [Errno 11001] getaddrinfo failed #331
Comments
ghost commented Feb 16, 2017
Getting the below error on numerous samples. add_vswitch_to_host.py and dc_create.py that I’ve tried. Others (vcenter_details.py for example) work fine. Tried to add ssl.SSLContext, but no good. Full error:
Traceback (most recent call last):
File «dc_create.py», line 39, in
sslContext= context)
File «c:python33libsite-packagespyVimconnect.py», line 817, in SmartConnect
sslContext)
File «c:python33libsite-packagespyVimconnect.py», line 702, in __FindSupportedVersion
sslContext)
File «c:python33libsite-packagespyVimconnect.py», line 622, in __GetServiceVersionDescription
path + «/vimServiceVersions.xml», sslContext)
File «c:python33libsite-packagespyVimconnect.py», line 588, in __GetElementTree
conn.request(«GET», path)
File «c:python33libhttpclient.py», line 1106, in request
self._send_request(method, url, body, headers)
File «c:python33libhttpclient.py», line 1151, in _send_request
self.endheaders(body)
File «c:python33libhttpclient.py», line 1102, in endheaders
self._send_output(message_body)
File «c:python33libhttpclient.py», line 934, in _send_output
self.send(msg)
File «c:python33libhttpclient.py», line 877, in send
self.connect()
File «c:python33libhttpclient.py», line 1252, in connect
super().connect()
File «c:python33libhttpclient.py», line 849, in connect
(self.host,self.port), self.timeout, self.source_address)
File «c:python33libsocket.py», line 693, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File «c:python33libsocket.py», line 732, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed
The text was updated successfully, but these errors were encountered:
blacksponge commented Jul 13, 2017
The only times I have got the error I mistyped the host. I have just tested add_vswitch_to_host.py and I didn’t have any problem to perform the connection. Are you sure that the host was reachable and that you didn’t mistype it ?
akhilesh-agrhari commented Jul 10, 2018 •
@blacksponge, I am having the same error. Can you please suggest me a correct host
blacksponge commented Jul 10, 2018
@akhilesh-agrhari sorry but that was quite a while ago and I don’t have the possibilty of doing any kind of test now. I would say an ip or valid domain name.
bill-rheda commented Dec 11, 2018
I have the same error and i can assure you that my host name and port is correct. What can i do about this please?
funny000 commented Sep 7, 2020
Traceback (most recent call last):
File «D:/Propy/pythonProject_douyu/douyu.py», line 267, in
client = DouyuClient(‘openbarrage.douyutv.com’,8601,data_callback=data_callback)
File «D:/Propy/pythonProject_douyu/douyu.py», line 132, in init
self.connect(address)
File «C:UsersadainAppDataLocalProgramsPythonPython37libasyncore.py», line 333, in connect
err = self.socket.connect_ex(address)
socket.gaierror: [Errno 11001] getaddrinfo failed
funny000 commented Sep 7, 2020
Have anypeopel solve the problem?
markdibe commented Mar 22, 2021
I am encountering the same issue
Traceback (most recent call last):
File «/app/EmailSender/main.py», line 9, in
EmailSender(push_file_path=__path).send_message()
File «/app/EmailSender/EmailSender.py», line 25, in send_message
Email_Auth(push_mail=config, path_file=path_file).send_mail(file_names=files)
File «/app/EmailSender/EmailSender.py», line 79, in send_mail
self.generate_smtp(msg)
File «/app/EmailSender/EmailSender.py», line 103, in generate_smtp
smtp = smtplib.SMTP(self.server, self.port)
File «/usr/local/lib/python3.9/smtplib.py», line 253, in init
(code, msg) = self.connect(host, port)
File «/usr/local/lib/python3.9/smtplib.py», line 339, in connect
self.sock = self._get_socket(host, port, self.timeout)
File «/usr/local/lib/python3.9/smtplib.py», line 310, in _get_socket
return socket.create_connection((host, port), timeout,
File «/usr/local/lib/python3.9/socket.py», line 822, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File «/usr/local/lib/python3.9/socket.py», line 953, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
avinkr commented May 6, 2021
Traceback (most recent call last):
File «C:UserslenovoDesktopKeyloggerkeylogger.py», line 124, in
keylogger.run()
File «C:UserslenovoDesktopKeyloggerkeylogger.py», line 94, in run
self.report()
File «C:UserslenovoDesktopKeyloggerkeylogger.py», line 57, in report
self.send_mail(self.email, self.password, «nn» + self.log)
File «C:UserslenovoDesktopKeyloggerkeylogger.py», line 50, in send_mail
server = smtplib.SMTP(‘smtp.gmail.com’, 587, message.encode(«utf8»))
File «C:UserslenovoAppDataLocalProgramsPythonPython39libsmtplib.py», line 255, in init
(code, msg) = self.connect(host, port)
File «C:UserslenovoAppDataLocalProgramsPythonPython39libsmtplib.py», line 341, in connect
self.sock = self._get_socket(host, port, self.timeout)
File «C:UserslenovoAppDataLocalProgramsPythonPython39libsmtplib.py», line 312, in _get_socket
return socket.create_connection((host, port), timeout,
File «C:UserslenovoAppDataLocalProgramsPythonPython39libsocket.py», line 822, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File «C:UserslenovoAppDataLocalProgramsPythonPython39libsocket.py», line 953, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed
barisdnmz commented Jul 28, 2022
Traceback (most recent call last):
File «C:UsersEmiHPPycharmProjectssftp_downloadmain.py», line 6, in
transport=paramiko.Transport((host,port))
File «C:UsersEmiHPAppDataLocalProgramsPythonPython39libsite-packagesparamikotransport.py», line 426, in init
addrinfos = socket.getaddrinfo(
File «C:UsersEmiHPAppDataLocalProgramsPythonPython39libsocket.py», line 954, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed
barisdnmz commented Jul 28, 2022
make sure that the hostname is just hostname and not including any path in the hostname variable, that fixed my problem.
Источник
0 / 0 / 0
Регистрация: 24.04.2019
Сообщений: 29
1
09.12.2019, 18:40. Показов 8547. Ответов 3
при запуске ошибка
Код
Traceback (most recent call last): File "C:UserswantedDesktopstillerstiler2.py", line 6, in <module> con = FTP("http://192.168.100.10/","admin","admin") File "C:UserswantedAppDataLocalProgramsPythonPython35libftplib.py", line 118, in __init__ self.connect(host) File "C:UserswantedAppDataLocalProgramsPythonPython35libftplib.py", line 153, in connect source_address=self.source_address) File "C:UserswantedAppDataLocalProgramsPythonPython35libsocket.py", line 689, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): File "C:UserswantedAppDataLocalProgramsPythonPython35libsocket.py", line 728, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno 11001] getaddrinfo failed
вот сам код прошу помочь указав на проблему
Python | ||
|
__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь
0
Потом запускаю воркер селери и он пишет что все нормально подключился к редису, но когда я отправляю запрос на сервер через сваггер, то он просто стоит грузится и потом пишет что Error 11001 connecting to redis:6379. getaddrinfo failed. Никто не сталкивался?
russian
programming
django
10:01 26.01.2022
2
ответов
зайди в контейнер и проверь что порт редиса доступен
10:08 26.01.2022
Похожие вопросы
Error:
… for res in _socket.getaddrinfo (Host, Port, Family, Type, Proto, Flags):
Socket.Gaierror: [Errno 11001] GetAddrinfo Failed
During Handling Of The Above Exception, Another Exception OccurRED:
Python Code:
# - * - Coding: UTF-8 - * -
Import urllib.request
From LXml.html Import Parse
Website = 'http://allrecipes.com'
Url_page = 'http://allrecipes.com/recipes/110/appetizers-and-snacks/deviled-eggs/?page='
Start_page = 1.
END_PAGE = 5.
DEF Correct_str (s):
RETURN S.NECODE ('UTF-8'). Decode ('ASCII', 'Ignore'). Strip ()
For i in Range (Start_Page, End_page + 1):
URL = URL_PAGE + STR (I)
HTML = URLLIB.Request.urlopen (URL)
Page = PARSE (HTML) .Getroot ()
# Skip video
For Elem In Page.xpath ('// * [@ id = "Grid"] / article [NOT (Contains (@Class, "Video-Card"))] / a [1]):
HREF = Website + Elem.get ('href')
title = Correct_str (elem.find ('H3'). Text)
Recipe_page = Parse (urllib.request.urlopen (href)). Getroot ()
photo_url = recipe_page.xpath ('// IMG [@ class = "REC-Photo"]') [0] .get ('src')
Print (' Nname: |', Title)
Print ('Photo: |', photo_url)
Console – Results:
traceback (most recent call last):
Name: | Crab-Stuffed Deviled Eggs
File "C: Users In AppData Local Programs Python Python35-32 lib urllib request.py", line 1240, in do_open
Photo: | http://images.media-allrecipes.com/userphotos/720x405/1091564.jpg
H.REQUEST (REQ.GET_METHOD (), REQ.Selector, Req.data, Headers)
File "C: Users in AppData Local Programs Python Python35-32 lib http client.py", Line 1083, in Request
Self._send_request (Method, URL, Body, Headers)
File "C: Users In AppData Local Programs Python Python35-32 lib http client.py", Line 1128, in _send_request
Self.Endheaders (Body)
File "C: Users in AppData Local Programs Python Python35-32 lib http client.py", Line 1079, in Endheaders
Self._send_output (Message_Body)
File "C: Users in AppData Local Programs Python Python35-32 lib http client.py", Line 911, in _send_output
Self.send (MSG)
File "C: Users In AppData Local Programs Python Python35-32 lib http client.py", Line 854, in sen
Self.Connect ()
File "C: Users in AppData Local Programs Python Python35-32 lib http client.py", Line 826, in Connect
(self.host, self.port), self.timeout, self.source_address)
File "C: Users in AppData Local Programs Python Python35-32 lib socket.py", Line 693, in Create_Connection
For Res in Getaddrinfo (Host, Port, 0, Sock_stream):
File "C: Users in AppData Local Programs Python Python35-32 lib socket.py", Line 732, in GetAddrinfo
For res in _socket.getaddrinfo (Host, Port, Family, Type, Proto, Flags):
Socket.Gaierror: [ERRNO 11001] GetAddrinfo Failed
DURING HANDLING OF THE ABOVE EXCEPTION, ANOTHER EXCEPTION OCCURRED:
Traceback (MOST Recent Call Last):
File "C: /Ussers/in/Dropbox/Parser/Test.py", Line 27, In & Lt; Module & GT;
Recipe_page = Parse (urllib.request.urlopen (href)). Getroot ()
File "C: Users in AppData Local Programs Python Python35-32 lib urllib request.py", Line 162, In Urlopen
Return Opener.open (URL, DATA, Timeout)
File "C: Users in AppData Local Programs Python Python35-32 lib urllib request.py", Line 465, In Open
Response = Self._Open (REQ, DATA)
File "C: Users In AppData Local Programs Python Python35-32 lib urllib request.py", Line 483, in _Open
'_Open', Req)
File "C: Users in AppData Local Programs Python Python35-32 lib urllib request.py", Line 443, in _call_chain
Result = Func (* Args)
File "C: Users in AppData Local Programs Python Python35-32 lib urllib request.py", Line 1268, in http_open
Return Self.do_Open (http.client.httpConnection, Req)
File "C: Users in AppData Local Programs Python Python35-32 lib Urllib Request.py", line 1242, in do_open
RAISE URLERROR (ERR)
urllib.error.urlerror: & lt; Urlopen Error [Errno 11001] GetAddrinfo Failed & GT;
Process Finished With Exit Code 1
Answer 1, Authority 100%
GetAddrinfo Failed in the simplest case occurs if the URL provided cannot find the address. For example, “http: // google “, “Localhos”, “http://slkdfj.com “
For a complete picture, you can read: https://msdn.microsoft.com/en-us/library/windows/desktop/ms738520%28v=vs.85%29.aspx , http://man7.org/linux/man-pages/man3/getaddrinfo.3.html depending on the used OS
For example, what MSDN says about this error: https://msdn.microsoft.com/en-us/library/windows/desktop/ms740668%28v=vs.85%29.aspx#wsahost_not_found
no such host is known. The Name IS Not An Official Host Name Or Alias,
Or Cannot Be Found in the Database (S) Being Queried. This Error May Also
BE RETURNED FOR PROTOCOL AND SERVICE QUERIES, AND MEANS THAT THE SETCIFIED
Name Could Not Be Found in the Relevant Database.
In more complex cases, it all depends on network settings, Firewall.