Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

JohnPT's avatar
JohnPT
Explorer | Level 3
3 years ago

Failed to establish a new connection: [WinError 10060] A connection attempt failed because the conne

Hi.  kind of stuck..  getting this error - worked two days ago. thanks for any ideas. 

 

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'

 

same code works fine on test machine but fails on, production.   errors on the final print line.

 

with this code


import dropbox
filetoupload = 'Z:\\users\\aeadmin\\documents\\ysn1.png'

filetouploadname = '/ysn1d.png'

 

f= open(filetoupload,"rb")

 

dbx = dropbox.Dropbox(
app_key = "x65cwwc7.....",
app_secret = "3s809......",
oauth2_refresh_token = "IjYGZB7V...."
)

 

print(dbx.files_upload(f.read(),filetouploadname, mode=dropbox.files.WriteMode("overwrite")))

15 Replies

  • Здравко's avatar
    Здравко
    Legendary | Level 20
    3 years ago

    JohnPT wrote:

    ...

    Exception has occurred: ConnectionError
    HTTPSConnectionPool(host='api.dropboxapi.com', port=443): Max retries exceeded with url: /oauth2/token (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001BBB8E9DFD0>: 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'))

    ...


    As I said, the refreshing process fails. The 'api.dropbox.com' is involved in this. Seems you didn't try to refresh by hand. Why? 🧐 Try ping the host, at least, and try query the server with alternative tool, all on the failing machine.

  • JohnPT's avatar
    JohnPT
    Explorer | Level 3
    3 years ago

    Thanks, sorry i was more focused on the PIP upgrade and creating a new app/refreshtoken.  thinking that the was the refresh you mention... 

     

    i guess not understanding  "as I said, check the refresh process by hand sorry."  was thinking that was the upgrade.. and the accesstoken did work and the refreshtoken not might indicate something with the app.  

     

    thanks for your patience.  how do i check the "refresh process"?  i thought that they never expired?

     

  • JohnPT's avatar
    JohnPT
    Explorer | Level 3
    3 years ago

    here is the ping

    C:\Users\.....>ping api.dropbox.com

    Pinging api-env.dropbox-dns.com [162.125.1.19] with 32 bytes of data:
    Reply from 162.125.1.19: bytes=32 time=4ms TTL=55
    Reply from 162.125.1.19: bytes=32 time=4ms TTL=55
    Reply from 162.125.1.19: bytes=32 time=4ms TTL=55
    Reply from 162.125.1.19: bytes=32 time=4ms TTL=55

    Ping statistics for 162.125.1.19:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
    Minimum = 4ms, Maximum = 4ms, Average = 4ms

  • Здравко's avatar
    Здравко
    Legendary | Level 20
    3 years ago

    JohnPT, Yes refresh token doesn't expire. It's used for periodical retrieve/refresh access token anew. This happens with specific request to Dropbox server (usually performed by SDK internally). That's something that fails. Let's see why. Take a look here about details on how OAuth works (including the refresh - last request). 'curl' is in use there; you can use whatever you want.

  • JohnPT's avatar
    JohnPT
    Explorer | Level 3
    3 years ago

    Thank you. will review. 

     

    FWIW: i did test on another cloud (Azure) machine wondering if it might be an Azure/port thing...  

     

    both apps (original and new ) worked fine with the refresh token.. so it must be something with the first machine.

    not sure how to trace that...

    I appreciate your help.

     

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!