Python-Requests close http connection

Posted by James Eggers on Stack Overflow See other posts from Stack Overflow or by James Eggers
Published on 2012-04-11T22:54:13Z Indexed on 2012/04/11 23:29 UTC
Read the original article Hit count: 430

Filed under:
|
|
|
|

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

With httplib it's HTTPConnection.close(), but how do I do the same with Requests?

Code is below:

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

    for line in r.iter_lines():
        if line:
            self.mongo['db'].tweets.insert(json.loads(line))

Thanks in advance.

© Stack Overflow or respective owner

Related posts about python

Related posts about http