wifi-locate icon indicating copy to clipboard operation
wifi-locate copied to clipboard

Locates your Wi-Fi-enabled machine using Wi-Fi access points signal strengths, using Google's API

wifi-locate (Python)

Locates the Wi-Fi-enabled machine using nearby Wi-Fi access points' relative signal strengths. Uses Google's API.

To use, call linux_scan or osx_scan, then give the result to locate which returns (accuracy, (lat,lng)).

Pretty useful for xflux or fetching weather.

Quick start:

Install:

pip install git+https://github.com/bshillingford/wifi-locate

Example:

from wifilocate import locate, linux_scan
accuracy, latlng = locate(linux_scan(device="wlan0", iwlist_path='/sbin/iwlist'))
print(accuracy, latlng)  # e.g. 25, (50.1234567, -1.234567)

Details

Calls Google's API (most likely used in Firefox, based on the URL). The module supports Python 2 and 3, and only depends on requests. If you don't yet have requests, consider my dependency on it a favour. It's great.

In Linux this uses iwlist, and in OS X it uses a little-known but built-in utility called airport.