diff options
author | 2012-04-17 19:36:13 +0530 | |
---|---|---|
committer | 2012-04-17 19:36:13 +0530 | |
commit | 57d76a1e76d77b23ed3e616dae761bc8e6b7021c (patch) | |
tree | e53bb0816bf91148647563cbb799bd17d019ec46 | |
parent | upgrade to git-2 eclass (diff) | |
download | gentoostats-57d76a1e76d77b23ed3e616dae761bc8e6b7021c.tar.gz gentoostats-57d76a1e76d77b23ed3e616dae761bc8e6b7021c.tar.bz2 gentoostats-57d76a1e76d77b23ed3e616dae761bc8e6b7021c.zip |
close HTTPConnection in finally block
-rwxr-xr-x | client/gentoostats-send | 3 | ||||
-rw-r--r-- | client/gentoostats/utils.py | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/client/gentoostats-send b/client/gentoostats-send index 324b2bc..2ae2857 100755 --- a/client/gentoostats-send +++ b/client/gentoostats-send @@ -72,6 +72,9 @@ def main(): except httplib.HTTPException: sys.stderr.write('Something went wrong') sys.exit(1) + finally: + if conn: + conn.close() if __name__ == "__main__": main() diff --git a/client/gentoostats/utils.py b/client/gentoostats/utils.py index 43a3c73..af807c8 100644 --- a/client/gentoostats/utils.py +++ b/client/gentoostats/utils.py @@ -18,6 +18,9 @@ def GET(server, url, headers, https=True): data = conn.getresponse().read() except httplib.HTTPException: return None + finally: + if conn: + conn.close() return data def deserialize(object): |