项目作者: bshillingford

项目描述 :
Locates your Wi-Fi-enabled machine using Wi-Fi access points signal strengths, using Google's API
高级语言: Python
项目地址: git://github.com/bshillingford/wifi-locate.git
创建时间: 2017-03-14T02:56:55Z
项目社区:https://github.com/bshillingford/wifi-locate

开源协议:

下载


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:

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

Example:

  1. from wifilocate import locate, linux_scan
  2. accuracy, latlng = locate(linux_scan(device="wlan0", iwlist_path='/sbin/iwlist'))
  3. 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.