Python-Requests close http connection

前端 未结 7 1395
既然无缘
既然无缘 2020-11-27 03:14

I was wondering, how do you close a connection with Requests (python-requests.org)?

With httplib it\'s HTTPConnection.close(), but how do I

7条回答
  •  悲&欢浪女
    2020-11-27 04:03

    please use response.close() to close to avoid "too many open files" error

    for example:

    r = requests.post("https://stream.twitter.com/1/statuses/filter.json", data={'track':toTrack}, auth=('username', 'passwd'))
    ....
    r.close()
    

提交回复
热议问题