×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    22

    Smile urllib module and network connection

    Hi,

    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:
    Code:
    conn = httplib.HTTPConnection(SERVER_NAME)
    conn.request("POST", UPLOAD_DIRECTORY, params, headers)
    conn.close()
    However, for my urllib calls, I do not know how to close the connections. The call that I make look like this:

    Code:
    onlineVersionFile = urllib.urlopen(URL + u"Version.py")
    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?

    Thanks,
    Hyon

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,852

    Re: urllib module and network connection

    hi Hyon
    there is a function close() inside the the URLopener class of the urllib module. But as far as i know there is no direct function to close a connection in urllib.

    Hope this helps
    Enjoy Pythoning
    Gaba88

Similar Threads

  1. Replies: 9
    Last Post: 2008-08-30, 07:05
  2. Replies: 0
    Last Post: 2008-01-28, 06:41
  3. Network based location in Python?
    By miohtama in forum Symbian
    Replies: 4
    Last Post: 2007-12-31, 09:40
  4. [announce] cenrep module for 3rd
    By cyke64 in forum Symbian
    Replies: 20
    Last Post: 2007-12-05, 17:14
  5. Python network questions......
    By drkorg in forum Symbian
    Replies: 2
    Last Post: 2006-09-22, 02:53

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×