4.2.2.5. Location¶
-
class
wsapiwrapper.consumer.location.
LocationWrapper
(baseurl: str, tokenstr: str)[source]¶ Wraps location endpoints of the Consumer API.
-
delete
(location_id: int) → int[source]¶ Delete one location by ID.
Makes a DELETE request to the Location endpoint. To delete locations the current user must have scanned the tag.
-
get
(location_id: int) → dict[source]¶ Get one location by its ID.
Makes a GET request to the Location endpoint.
-
get_list
(tagserial: str, starttime: str = None, endtime: str = None) → list[source]¶ Get a list of locations for a tag.
Optionally a time window can be specified, so that only location timestamps within that window will be returned.
Makes a GET request to the Locations endpoint.
- Parameters
tagserial – Base64 serial identifying a tag.
starttime – Start datetime as an ISO-8601 string.
endtime – End datetime as an ISO-8601 string.
- Returns
A list of Location dictionaries.
- Return type
-
patch
(location_id: int, description: str) → dict[source]¶ Change description of an existing location.
The current user must have scanned the tag.
-
post
(capturesample_id: int, description: str) → dict[source]¶ Annotate a sample with location.
The timestamp of a location corresponds to that of its parent sample. All samples can be traced back to the tag that created them. This must have been scanned by the current user.
-
static
process_status
(status_code: int, desc='') → None[source]¶ Raise an exception in response to an HTTP error code.
- Parameters
status_code – HTTP status code.
-