The Google Maps Geolocation API returns a location and accuracy radius based on information about cell towers and WiFi nodes given. See https://developers.google.com/maps/documentation/geolocation/intro for more info, including more detail for each parameter below. :param home
(client, home_mobile_country_code=None,
home_mobile_network_code=None, radio_type=None, carrier=None,
consider_ip=None, cell_towers=None, wifi_access_points=None)
| 43 | |
| 44 | |
| 45 | def geolocate(client, home_mobile_country_code=None, |
| 46 | home_mobile_network_code=None, radio_type=None, carrier=None, |
| 47 | consider_ip=None, cell_towers=None, wifi_access_points=None): |
| 48 | """ |
| 49 | The Google Maps Geolocation API returns a location and accuracy |
| 50 | radius based on information about cell towers and WiFi nodes given. |
| 51 | |
| 52 | See https://developers.google.com/maps/documentation/geolocation/intro |
| 53 | for more info, including more detail for each parameter below. |
| 54 | |
| 55 | :param home_mobile_country_code: The mobile country code (MCC) for |
| 56 | the device's home network. |
| 57 | :type home_mobile_country_code: string |
| 58 | |
| 59 | :param home_mobile_network_code: The mobile network code (MCC) for |
| 60 | the device's home network. |
| 61 | :type home_mobile_network_code: string |
| 62 | |
| 63 | :param radio_type: The mobile radio type. Supported values are |
| 64 | lte, gsm, cdma, and wcdma. While this field is optional, it |
| 65 | should be included if a value is available, for more accurate |
| 66 | results. |
| 67 | :type radio_type: string |
| 68 | |
| 69 | :param carrier: The carrier name. |
| 70 | :type carrier: string |
| 71 | |
| 72 | :param consider_ip: Specifies whether to fall back to IP geolocation |
| 73 | if wifi and cell tower signals are not available. Note that the |
| 74 | IP address in the request header may not be the IP of the device. |
| 75 | :type consider_ip: bool |
| 76 | |
| 77 | :param cell_towers: A list of cell tower dicts. See |
| 78 | https://developers.google.com/maps/documentation/geolocation/intro#cell_tower_object |
| 79 | for more detail. |
| 80 | :type cell_towers: list of dicts |
| 81 | |
| 82 | :param wifi_access_points: A list of WiFi access point dicts. See |
| 83 | https://developers.google.com/maps/documentation/geolocation/intro#wifi_access_point_object |
| 84 | for more detail. |
| 85 | :type wifi_access_points: list of dicts |
| 86 | """ |
| 87 | |
| 88 | params = {} |
| 89 | if home_mobile_country_code is not None: |
| 90 | params["homeMobileCountryCode"] = home_mobile_country_code |
| 91 | if home_mobile_network_code is not None: |
| 92 | params["homeMobileNetworkCode"] = home_mobile_network_code |
| 93 | if radio_type is not None: |
| 94 | params["radioType"] = radio_type |
| 95 | if carrier is not None: |
| 96 | params["carrier"] = carrier |
| 97 | if consider_ip is not None: |
| 98 | params["considerIp"] = consider_ip |
| 99 | if cell_towers is not None: |
| 100 | params["cellTowers"] = cell_towers |
| 101 | if wifi_access_points is not None: |
| 102 | params["wifiAccessPoints"] = wifi_access_points |