UnwiredLabs Location API客户端。
unwiredlabs的Python项目详细描述
这在python中实现了unwiredlabs location api协议
安装
只需使用pip:
安装pip install unwiredlabs
用法
python示例:
import unwiredlabs key = 'ABCDEF1234567890' # from the API console bssid = 'ab:cd:ef:12:34:56' rssi = -60 request = unwiredlabs.UnwiredRequest() request.addAccessPoint(bssid, rssi) connection = unwiredlabs.UnwiredConnection(key=key) response = connection.performRequest(request) if response.status != 'Ok': print('Error:', response.status) else: print('Response: ', response.coordinate)
命令行客户端
在test目录中,您将找到一个命令行客户机来测试是否一切正常:
$ python cmdline_client.py --help usage: cmdline_client.py [-h] -k KEY [-w WIFI] [-g GPS] [-c CELL] [-l LTE] [-u UMTS] [-m CDMA] [-a] Make a location request against the unwiredlabs location API optional arguments: -h, --help show this help message and exit -k KEY, --key KEY token from Unwired API panel -w WIFI, --wifi WIFI WIFI BSSID and signal strength (format: XX:XX:XX:XX:XX:XX@RSSI) -g GPS, --gps GPS GPS coordinate (format: latitude,longitude@num_satelites) -c CELL, --cell CELL, --celltower CELL GSM Celltower information (format: MCC,MNC,LAC,CellID@RSSI) -l LTE, --lte LTE LTE Celltower information (format: MCC,MNC,LAC,CellID@RSSI) -u UMTS, --umts UMTS UMTS (3G) Celltower information (format: MCC,MNC,LAC,CellID@RSSI) -m CDMA, --cdma CDMA CDMA/EVDO Celltower information (format: MCC,MNC,LAC,CellID@RSSI) -a, --address Fetch address info in addition to coordinates