×

Discussion Board

Results 1 to 9 of 9

Thread: python urllib

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    3

    python urllib

    Hi

    I am using the following

    for website in websiteList:
    content = urllib.urlopen(website).read()
    do something here with the content

    Please note the last line is psuedo code just for example of usage here.

    Each time I run this statement the N95 wants me to select the means of accessing the internet each time. Why do I have to do this each time is there a way for some code to automatically to select the method to access the web?

    Thanks for your help. Ray

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

    Re: python urllib

    Quote Originally Posted by salsagoo View Post
    Hi

    I am using the following

    for website in websiteList:
    content = urllib.urlopen(website).read()
    do something here with the content

    Please note the last line is psuedo code just for example of usage here.

    Each time I run this statement the N95 wants me to select the means of accessing the internet each time. Why do I have to do this each time is there a way for some code to automatically to select the method to access the web?

    Thanks for your help. Ray
    hi salsagoo welcome to the wonderful and best python dibo.
    ur question seems interesting but the answer is as many times the connection is established the the operator is charging u for that data transfer so it is the functionality of operating system to make u know that u r charged and i dont think something in python is available to change that setting.
    plz give feedback
    thanx

  3. #3
    Nokia Developer Moderator
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: python urllib

    This sets the default access point. I haven't tested it, but it should theoretically eliminate the need to select repeatedly.

    Code:
    from socket import *
    
    apid = select_access_point()  #Prompts you to select the access point
    apo = access_point(apid)      #apo is the access point you selected
    set_default_access_point(apo) #Sets apo as the default access point
    I hope I understood your question.

  4. #4
    Registered User
    Join Date
    Apr 2008
    Posts
    3

    Re: python urllib

    Hola..wow must say I am impressed with the quick response. I will try the code with the latest reply.

    As for the previous reply I have an unlimited flat rate per month so I don't need to stress if the operator will charger heavily for the data. I appreciate that this can be very costly in some countries.

    Will be back with some feedback soon. /ray

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

    Re: python urllib

    Quote Originally Posted by salsagoo View Post
    Hola..wow must say I am impressed with the quick response. I will try the code with the latest reply.

    As for the previous reply I have an unlimited flat rate per month so I don't need to stress if the operator will charger heavily for the data. I appreciate that this can be very costly in some countries.

    Will be back with some feedback soon. /ray
    hi salasagoo again
    i said that u r i the best python discussion board so the reply will be the quickest.
    try out wid the code provided by the champion bogdan.
    and surely keep asking questions and try to give some replies also thanks.

  6. #6
    Registered User
    Join Date
    Apr 2008
    Posts
    3

    Re: python urllib

    Hi, I have just tested the code provided by Bogdan, and I get the results I was looking for. Many thanks for your help with this. You saved me some oil that I would have been burning tonight to figure this out. I appreciate the effort you guys bring to this forum. thanks ray

  7. #7
    Registered User
    Join Date
    Dec 2008
    Posts
    27

    Re: python urllib set default access point

    Hi,

    My code is

    import btsocket
    import urllib2

    apid = btsocket.select_access_point() #Prompts you to select the access point
    apo = btsocket.access_point(apid) #apo is the access point you selected
    btsocket.set_default_access_point(apo) #Sets apo as the default access point

    f = urllib2.urlopen('http://www.python.org/')
    print f.read(100)

    When I run my script, its asking to select the access point twice (one for btsocket and other for urllib2).

    Please help me how to use set default access point without prompting the user again and again.

    Waiting for your reply.

    Thanks
    Sathya

  8. #8
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: python urllib set default access point

    Quote Originally Posted by sathyanand View Post
    When I run my script, its asking to select the access point twice (one for btsocket and other for urllib2).

    Please help me how to use set default access point without prompting the user again and again.
    This might help you: http://jouni.miettunen.googlepages.com/accesspointtest

    Please note it's tested only with PyS60 1.4.5. I haven't (yet) checked how it would work with latest and greatest PyS60 2.0.0 release.

    Cheers,

    --jouni

  9. #9
    Super Contributor
    Join Date
    Nov 2007
    Location
    Sertaozinho/Brazil
    Posts
    768

    Re: python urllib


Similar Threads

  1. Please help installing Python libraries on S60
    By ericroijen in forum Symbian
    Replies: 11
    Last Post: 2009-07-18, 10:43
  2. [announce] PyUIQ. Python for UIQ 2.1 and 3.x
    By OscarBernabeu in forum Symbian
    Replies: 35
    Last Post: 2008-01-17, 09:12
  3. Replies: 1
    Last Post: 2008-01-08, 09:58
  4. Replies: 11
    Last Post: 2007-10-03, 19:46
  5. Replies: 3
    Last Post: 2007-03-13, 06:50

Posting Permissions

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