I have a program that connects to the internet via urllib and httplib modules. For the httplib part of the code, I open and close connection as follows:
However, for my urllib calls, I do not know how to close the connections. The call that I make look like this:
conn = httplib.HTTPConnection(SERVER_NAME)
conn.request("POST", UPLOAD_DIRECTORY, params, headers)
Also, how much extra battery does it drain to leave these connections open? My 5500 is collecting accelerometer data constantly and so the battery life is a little less than 24 hours. Does having this connection open all the time affect the battery life a lot?
onlineVersionFile = urllib.urlopen(URL + u"Version.py")