Over a million developers have joined DZone.

Prompt Once And ONCE ONLY For Connection (access Point) To Use

·
Simple to see what's going on here.. it just took me a while to find the API calls so thought I should share it.

Once the default access point is set, the likes of urllib will not prompt again during the running of the script.

You could take this further by e.g. writing the selected access point Id to a config file if you never want the user to be prompted again.

In PyS60 versions before 1.9.x:

import socket
socket.set_default_access_point(socket.access_point(socket.select_access_point()))


In PyS60 versions 1.9.x and above:

import btsocket
btsocket.set_default_access_point(btsocket.access_point(btsocket.select_access_point()))


The reason for the difference: As of PyS60 1.9.x the module "socket" has been renamed to "btsocket". This is because of the name clash between the PyS60 extension module and the Python(2.5.1) core module. 

Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}