tgalal / yowsup

The WhatsApp lib
GNU General Public License v3.0
7.06k stars 2.23k forks source link

TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connectio n failed because connected host has failed to respond #319

Closed Harrrykrishnan closed 9 years ago

Harrrykrishnan commented 10 years ago

Command I tried is

python yowsup-cli --requestcode voice -c D:\Official\Work\RTB\CEM\RTB\yowsup-master\yowsup-master\src/yowsup-cli.conf

Getting Following error while connecting. Request for the help.

File "D:\Official\Work\RTB\CEM\RTB\yowsup-master\yowsup-master\src\Yowsup\Comm on\Http\warequest.py", line 194, in sendRequest conn.request(reqType, path, params, headers); File "C:\Python34\lib\http\client.py", line 1090, in request self._send_request(method, url, body, headers) File "C:\Python34\lib\http\client.py", line 1128, in _send_request self.endheaders(body) File "C:\Python34\lib\http\client.py", line 1086, in endheaders self._send_output(message_body) File "C:\Python34\lib\http\client.py", line 924, in _send_output self.send(msg) File "C:\Python34\lib\http\client.py", line 859, in send self.connect() File "C:\Python34\lib\http\client.py", line 1221, in connect super().connect() File "C:\Python34\lib\http\client.py", line 836, in connect self.timeout, self.source_address) File "C:\Python34\lib\socket.py", line 509, in create_connection raise err File "C:\Python34\lib\socket.py", line 500, in create_connection sock.connect(sa) TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connectio n failed because connected host has failed to respond

ebaskoro commented 10 years ago

Looks like there is a network issue between your PC and the server. Perhaps firewall settings?

vedantsali commented 8 years ago

any solutions?

reddi87 commented 8 years ago

Same issue here. If i try to type in the Output of the GET-Request from debug into the broweser i get the following answer: {"status":"fail","reason":"bad_token"} . Is there any solution?

pankajberwal commented 6 years ago

C:\Users\panka\AppData\Local\Programs\Python\Python35-32\python.exe C:/Users/panka/PycharmProjects/bucky/webCrawling.py Traceback (most recent call last): File "C:\Users\panka\AppData\Local\Programs\Python\Python35-32\lib\site-packages\urllib3\connection.py", line 141, in _new_conn (self.host, self.port), self.timeout, **extra_kw) File "C:\Users\panka\AppData\Local\Programs\Python\Python35-32\lib\site-packages\urllib3\util\connection.py", line 83, in create_connection raise err File "C:\Users\panka\AppData\Local\Programs\Python\Python35-32\lib\site-packages\urllib3\util\connection.py", line 73, in create_connection sock.connect(sa) TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\panka\AppData\Local\Programs\Python\Python35-32\lib\site-packages\urllib3\connectionpool.py", line 601, in urlopen chunked=chunked) File "C:\Users\panka\AppData\Local\Programs\Python\Python35-32\lib\site-packages\urllib3\connectionpool.py", line 346, in _make_request self._validate_conn(conn) File "C:\Users\panka\AppData\Local\Programs\Python\Python35-32\lib\site-packages\urllib3\connectionpool.py", line 850, in _validate_conn conn.connect() File "C:\Users\panka\AppData\Local\Programs\Python\Python35-32\lib\site-packages\urllib3\connection.py", line 284, in connect conn = self._new_conn() File "C:\Users\panka\AppData\Local\Programs\Python\Python35-32\lib\site-packages\urllib3\connection.py", line 150, in _new_conn self, "Failed to establish a new connection: %s" % e) urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x03C85FB0>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\panka\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\adapters.py", line 440, in send timeout=timeout File "C:\Users\panka\AppData\Local\Programs\Python\Python35-32\lib\site-packages\urllib3\connectionpool.py", line 639, in urlopen _stacktrace=sys.exc_info()[2]) File "C:\Users\panka\AppData\Local\Programs\Python\Python35-32\lib\site-packages\urllib3\util\retry.py", line 388, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='buckysroom.org', port=443): Max retries exceeded with url: /trade/search.php?page=1 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x03C85FB0>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:/Users/panka/PycharmProjects/bucky/webCrawling.py", line 39, in trade_spider(1) File "C:/Users/panka/PycharmProjects/bucky/webCrawling.py", line 9, in trade_spider source_code = requests.get(url) File "C:\Users\panka\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\api.py", line 72, in get return request('get', url, params=params, kwargs) File "C:\Users\panka\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\api.py", line 58, in request return session.request(method=method, url=url, kwargs) File "C:\Users\panka\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\sessions.py", line 508, in request resp = self.send(prep, send_kwargs) File "C:\Users\panka\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\sessions.py", line 618, in send r = adapter.send(request, kwargs) File "C:\Users\panka\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests\adapters.py", line 508, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='buckysroom.org', port=443): Max retries exceeded with url: /trade/search.php?page=1 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x03C85FB0>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond',))

Process finished with exit code 1

ceylanb commented 6 years ago

+1

OmSao commented 6 years ago

Remove any proxy in your Environment variable or bash profile/terminal. Open Command terminal as an Administrator or run as sudo in case of Linux terminal and then try.

luisVargasGu commented 5 years ago

I find that I get this error if I'm opening up too many instances at the same time.

nikhil24agarwal commented 4 years ago

+1

alirezazarei28 commented 4 years ago

for anyone who still has this issue after removing any proxy and checking network connection, maybe this answer on StackOverflow would help: Python requests error 10060

Kirubakaran-S-Official commented 3 years ago

check your internet connection ....... after changed the network connectivity ..... this problem doesn't occur next for me

indiangamex commented 3 years ago

Server side code I am getting the same error whenever i am connecting to other laptop on my local network to send commands but it repeatedly failed to establish connection

import socket
import threading
HEADER = 64
PORT = 5000
dis = `"!disconnect"`
Format = "utf-8"
SERVER = socket.gethostbyname(socket.gethostname())
ADDR = (SERVER, PORT)
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(ADDR)
def handler(conn, addr):
    print("new connection{}".format(addr))
    connected = True
    while connected:
            msg_length = conn.recv(HEADER).decode(Format)
            if msg_length:
                msg_length = int(msg_length)
                msg = conn.recv(msg_length).decode(Format)
                print("{}: {}".format(addr, msg))
                if msg == dis:
                    connected = False
            conn.send("msg received".encode(Format))
    conn.close()
def client():
    import subprocess
    subprocess.run("python3 client.py",shell = True)
def start():
    server.listen()
    while True:
        conn,addr = server.accept()
        thread = threading.Thread(target=handler, args=(conn, addr))
        thread.start()
        print(f"[Active Connections]{threading.activeCount() - 1}")
print("server up and running....")
print("server {} listening at port {}".format(SERVER, PORT))
start()

client side code

import socket
import threading
HEADER = 64
PORT = 5000
dis = "!disconnect"
Format = "utf-8"
SERVER = "depends on above ip"
ADDR = (SERVER, PORT)
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(ADDR)
def send(msg):
    message = msg.encode(Format)
    msg_length = len(message)
    send_length = str(msg_length).encode(Format)
    send_length += b' ' * (HEADER - len(send_length))
    client.send(send_length)
    client.send(message)
while True:
    msg_in = input("i")
    send(msg_in)
    if msg_in == dis:
        print("thanks for using us !")
        exit()
error/traceback

File "C:\Users\ghosh\OneDrive\Desktop\chat system\client.py", line 10, in <module> client.connect(ADDR) TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

indiangamex commented 3 years ago

even turned of firewall on both device please help

vergelli commented 3 years ago

The same is happening to me with different technology. My requests do this

hadi-learn commented 3 years ago

+1

thisis-vishal commented 3 years ago

Command I tried is

python yowsup-cli --requestcode voice -c D:\Official\Work\RTB\CEM\RTB\yowsup-master\yowsup-master\src/yowsup-cli.conf

Getting Following error while connecting. Request for the help.

File "D:\Official\Work\RTB\CEM\RTB\yowsup-master\yowsup-master\src\Yowsup\Comm on\Http\warequest.py", line 194, in sendRequest conn.request(reqType, path, params, headers); File "C:\Python34\lib\http\client.py", line 1090, in request self._send_request(method, url, body, headers) File "C:\Python34\lib\http\client.py", line 1128, in _send_request self.endheaders(body) File "C:\Python34\lib\http\client.py", line 1086, in endheaders self._send_output(message_body) File "C:\Python34\lib\http\client.py", line 924, in _send_output self.send(msg) File "C:\Python34\lib\http\client.py", line 859, in send self.connect() File "C:\Python34\lib\http\client.py", line 1221, in connect super().connect() File "C:\Python34\lib\http\client.py", line 836, in connect self.timeout, self.source_address) File "C:\Python34\lib\socket.py", line 509, in create_connection raise err File "C:\Python34\lib\socket.py", line 500, in create_connection sock.connect(sa) TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connectio n failed because connected host has failed to respond

use smtplib.SMTP("smtp.gmail.com",port=587)

korniarp commented 3 years ago

Hey @indiangamex ! I am facing the same issue. Could you resolve it?

JMCS1 commented 3 years ago

same issue when running in a VM... but when i do it in my own PC the same code works properly... does this clue tells you something? I cant solve it

korniarp commented 3 years ago

Hi @JMCS1 I solved it by changing my port. I put any number above 6000. May be you wanna try like that.

Shubham97shbh commented 3 years ago

Go to that account from where you are login with SMTP then try to find security settings where you will find: https://myaccount.google.com/lesssecureapps and try to turn ON

SyedMaazHassan commented 2 years ago

Hey @indiangamex ! I am facing the same issue. Could you resolve it?

I found the same issue

mr-swaraj-chaudhary commented 2 years ago

Go to that account from where you are login with SMTP then try to find security settings where you will find: https://myaccount.google.com/lesssecureapps and try to turn ON

setting unavailable

codeshoel commented 2 years ago

Go to that account from where you are login with SMTP then try to find security settings where you will find: https://myaccount.google.com/lesssecureapps and try to turn ON

please it is best we note that google gmail lesssecureapp is no long available in google anymore

what you can do is to turn on two step verification from your security page and register an app name, then generate a password you can use on your django email setting snippet in your settings.py file. for more understanding follow this link: https://myaccount.google.com/security

CaptScott331 commented 1 year ago

I'm running into the connection failed error on my PC. When I ran my code on my laptop, it worked fine, but not on my PC. I made sure VS was approved in firewall. Any other suggestions?

bpalomino5920 commented 1 year ago

https://stackoverflow.com/questions/6979678/python-smtp-errno-10060/6979864#6979864?newreg=d9b738a44aa74b04b5854b65bf502bdb

maybe try this guys. I did not use starttls....instead, I used smtplib.SMTP_SSL("smtp.gmail.com", 465). It worked on my end

Darkd-as commented 1 year ago

When I download nltk package then it shows "WinError 10060) A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"

Anyone please help me

ijazul-haq commented 1 year ago

('Connection aborted.', TimeoutError(10060, 'A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond', None, 10060, None)

demonpratapdemon commented 1 year ago

I am getting this error when I am trying to use WiFi but with my mobile hotspot I am able to get the data from server. Can anyone help on this?

yoryis commented 1 year ago

I solved it by using the port=587 in my VM with smtplib.SMTP("smtp.gmail.com", port=587) as connection:

POJASHO commented 1 year ago

Thank you

I solved it by using the port=587 in my VM with smtplib.SMTP("smtp.gmail.com", port=587) as connection:

Divya9878 commented 1 year ago

When I download nltk package then it shows "WinError 10060) A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"

Please help with the error

sujalamati commented 11 months ago

When I download nltk package then it shows "WinError 10060) A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"

Please help with the error

use a personal hotspot , it worked for me !

JasmineJena99 commented 11 months ago

I was getting this error while trying to download nltk in jupyter. It worked after I changed my connection to a VPN

Garvit20012007 commented 9 months ago

everyone please download 1.1.1.1 vpn

Aizad-eng commented 6 months ago

Please try this method to debug the issue.

1- Go to Windows search bar and type "Turn Windows features On or off" > Find telnet client, enable it and click ok:

Once it is enabled.

image

2 - Go to search bar and open the command prompt.

run this command there telnet YOUR_SMTP_HOSTNAME 587

image

Paste the screenshot of the response below.

Thanks!