Why doesn't requests.get() return? What is the default timeout that requests.get() uses?

后端 未结 6 1865
时光说笑
时光说笑 2020-11-28 05:09

In my script, requests.get never returns:

import requests

print (\"requesting..\")

# This call never returns!
r = requests.get(
    \"http://w         


        
6条回答
  •  天涯浪人
    2020-11-28 05:32

    What is the default timeout that get uses?

    The default timeout is None, which means it'll wait (hang) until the connection is closed.

    What happens when you pass in a timeout value?

    r = requests.get(
        'http://www.justdial.com',
        proxies={'http': '222.255.169.74:8080'},
        timeout=5
    )
    

提交回复
热议问题