Endpoints¶
Geofences¶
-
class
radar.endpoints.
Geofences
(radar, requester)[source]¶ -
create
(data={})[source]¶ Creates a geofence.
If a geofence with the specified tag and externalId already exists, the request will fail.
https://radar.io/documentation/api#create-geofence
Returns: Geofence
-
get
(id=None, tag=None, externalId=None)[source]¶ Gets a geofence by id or tag and externalId
https://radar.io/documentation/api#get-geofence
Returns: Geofence
-
list
(limit=None, createdBefore=None, createdAfter=None, tag=None)[source]¶ Lists geofences. Geofences are sorted descending by createdAt
https://radar.io/documentation/api#list-geofences
Parameters: - limit (int, optional (default=100)) – max number of geofences to return.
- createdBefore (datetime, optional (default=None)) – pagination cursor.
- createdAfter (datetime, optional (default=None)) – pagination cursor.
- tag (str, optional (default=None)) – lists geofences with specified tag.
Returns: list of
Geofence
-
list_users
(id=None, tag=None, externalId=None, limit=None, updateBefore=None, updatedAfter=None)[source]¶ Lists users in a geofence.
The geofence can be uniquely referenced by Radar _id or by tag and externalId. Users are sorted descending by updatedAt.
https://radar.io/documentation/api#list-geofence-users
Returns: list of User
-
upsert
(tag=None, externalId=None, data={})[source]¶ Upserts a geofence.
If a geofence with the specified tag and externalId already exists, it will be updated. If not, it will be created.
https://radar.io/documentation/api#upsert-geofence
Returns: Geofence
-
Users¶
-
class
radar.endpoints.
Users
(radar, requester)[source]¶ -
delete
(id=None, userId=None, deviceId=None)[source]¶ Deletes a user. The user can be referenced by Radar _id, userId, or deviceId
-
get
(id=None, userId=None, deviceId=None)[source]¶ Gets a user. The user can be referenced by Radar _id, userId, or deviceId
https://radar.io/documentation/api#get-user
Returns: User
-
list
(limit=None, updatedBefore=None, updatedAfter=None)[source]¶ List users, sorted descending by updatedAt
https://radar.io/documentation/api#list-users
Parameters: - limit (int, optional (default=100)) – Max number of users to return.
- updateBefore (datetime, optional) – A cursor for use in pagination. Retrieves users updated before the specified datetime.
- updatedAfter (datetime, optional) – A cursor for use in pagination. Retrieves users updated after the specified datetime.
Returns: list of
User
-
Events¶
-
class
radar.endpoints.
Events
(radar, requester)[source]¶ -
-
get
(id)[source]¶ Gets an event. The event can be uniquely referenced by Radar _id
https://radar.io/documentation/api#get-event
Returns: Event
-
list
(limit=None, createdBefore=None, createdAfter=None)[source]¶ Lists events. Events are sorted descending by createdAt.
https://radar.io/documentation/api#list-events
Parameters: - limit (int, optional (default=100)) – Max number of events to return.
- createdBefore (datetime, optional) – A cursor for use in pagination. Retrieves events created before the specified datetime.
- createdAfter (datetime, optional) – A cursor for use in pagination. Retrieves events created after the specified datetime.
Returns: list of
Event
-
verify
(id, verification=None, value=None, verifiedPlaceId=None)[source]¶ Verifies an event.
Events can be accepted or rejected after user check-ins or other forms of verification. Event verifications will be used to improve the confidence level of future events.
https://radar.io/documentation/api#verify-event
Parameters: - id (str) – id of the event to verify
- verification (str, optional) – one of “accept”, “reject”, “unverify”
- value (int, optional) – one of 1 (accept), -1 (reject), 0 (unverify)
- verifiedPlaceId (str, optional) – For user.entered_place events, the ID of the verified place.
Example
>>> radar.events.verify('123', 'accept') >>> radar.events.verify('123', value=1)
-
Context¶
-
class
radar.endpoints.
Context
(radar, requester)[source]¶ -
get
(coordinates)[source]¶ Gets context for a location without sending device or user identifiers to the server.
Parameters: coordinates ((latitude, longitude)) – the coordinates of the location Examples
>>> radar.context.get(coordinates=(40.123, -73.456))
Returns: object with the radar context for the provided location Return type: RadarContext
-
Geocode¶
-
class
radar.endpoints.
Geocode
(radar, requester)[source]¶ -
forward
(query)[source]¶ Geocodes an address, converting address to coordinates.
https://radar.io/documentation/api#geocode-forward
Parameters: query (str) – The address to geocode. Returns: list of Address
-
ip
(ip)[source]¶ Geocodes an IP address, converting IP address to partial address.
https://radar.io/documentation/api#geocode-ip
Parameters: ip (str) – The IP address to geocode. Returns: :class:`~radar.models.address.Address
-
reverse
(coordinates)[source]¶ Reverse geocodes a location, converting coordinates to address.
https://radar.io/documentation/api#geocode-reverse
Parameters: coordinates ((latitude, longitude)) – the coordinates to reverse geocode Returns: list of Address
-
Search¶
-
class
radar.endpoints.
Search
(radar, requester)[source]¶ -
autocomplete
(query, near, limit=None)[source]¶ Autocompletes partial addresses and place names, sorted by relevance.
https://radar.io/documentation/api#search-autocomplete
Parameters: - query (str) – The partial address or place name to autocomplete.
- near ((latitude,longitude)) – A location for the search in the format (latitude,longitude).
- limit (int, optional (default=10)) – The max number of addresses to return. A number between 1 and 100.
Returns: list of
Address
Example
>>> radar.search.autocomplete(near=(40.7041029,-73.98706), categories="coffee-shop") [<Radar Place: name='Brooklyn Roasting Company'>, <Radar Place: name='Starbucks'>, <Radar Place: name="Dunkin'">]
-
geofences
(near, tags=None, radius=None, limit=None)[source]¶ Searches for geofences near a location, sorted by distance.
https://radar.io/documentation/api#search-geofences
Parameters: - near ((latitude, longitude)) – A location for the search in the format (latitude,longitude).
- tags (str, optional) – The tags to filter. A string, comma-separated.
- radius (int, optional (default=1000)) – The radius to search, in meters. A number between 100 and 10000.
- limit (int, optional (default=100)) – The max number of geofences to return. A number between 1 and 1000.
Returns: list of
Geofence
-
places
(near, chains=None, categories=None, groups=None, radius=None, limit=None)[source]¶ Searches for places near a location, sorted by distance.
https://radar.io/documentation/api#search-places
Parameters: - near ((latitude,longitude)) – A location for the search in the format (latitude,longitude).
- chains (str, optional) – The chain slugs to filter. A string, comma-separated.
- categories (str, optional) – The categories to filter. A string, comma-separated.
- groups (str, optional) – The groups to filter. A string, comma-separated.
- radius (int, optional (default=1000)) – The radius to search, in meters. A number between 100 and 10000.
- limit (int, optional (default=100)) – The max number of places to return. A number between 1 and 1000.
Returns: list of
Place
Example
>>> radar.search.places(query="brooklyn roasting", near=(40.7041029,-73.98706))
-
users
(near, radius=None, limit=None)[source]¶ Searches for users near a location, sorted by distance.
https://radar.io/documentation/api#search-users
Parameters: - near ((latitude, longitude)) – A location for the search. pair of latitude,longitude.
- radius (int, optional (default=1000)) – The radius to search, in meters. A number between 100 and 10000.
- limit (int, optional (default=100)) – The max number of places to return. A number between 1 and 1000.
Returns: list of
User
-
Route¶
-
class
radar.endpoints.
Route
(radar, requester)[source]¶ -
distance
(origin, destination, modes, units='metric')[source]¶ Calculates the travel distance and duration between two locations.
https://radar.io/documentation/api#route-distance
Parameters: - origin (str) – The origin. A string in the format latitude,longitude.
- destination (str) – The destination. A string in the format latitude,longitude.
- modes (str) – The travel modes. A string, comma-separated, including one or more of foot, bike, car, and transit.
- units (str, optional (default="metric")) – The distance units. A string, metric or imperial.
Returns:
-