Skip to content

Commit

Permalink
fix: retrieve media metadata values (#217)
Browse files Browse the repository at this point in the history
* docs: fixed typo in docs
* fix: send correct field name to landinglens api
  • Loading branch information
hrnn authored Sep 13, 2024
1 parent afcf9e4 commit 85bb448
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ YOUR_API_KEY = "land_sk_12345"
YOUR_PROJECT_ID = 1190
metadata_client = Metadata(YOUR_PROJECT_ID, YOUR_API_KEY)
# Set three metadata values ('timestamp', 'country' and 'labeler') for images with IDs 123 and 124
metadata_client.update(media_id=[123, 124], timestamp=12345, country="us", labeler="tom")
metadata_client.update(media_ids=[123, 124], timestamp=12345, country="us", labeler="tom")
# Output:
# {
# project_id: 1190,
Expand Down
2 changes: 1 addition & 1 deletion landingai/data_management/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def update(
def get(self, media_id: int) -> Dict[str, str]:
"""Return all the metadata associated with a given media."""
resp = self._client._api(
METADATA_GET, params={"mediaId": media_id, "objectType": "media"}
METADATA_GET, params={"objectId": media_id, "objectType": "media"}
)
_, id_to_metadata = self._client.get_metadata_mappings(self._client._project_id)
return {id_to_metadata[int(k)]: v for k, v in resp["data"].items()}
Expand Down
2 changes: 1 addition & 1 deletion pdocs/user_guide/5_data_management.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ YOUR_API_KEY = "land_sk_12345"
YOUR_PROJECT_ID = 1190
metadata_client = Metadata(YOUR_PROJECT_ID, YOUR_API_KEY)
# Set three metadata values ('timestamp', 'country' and 'labeler') for images with IDs 123 and 124
metadata_client.update(media_id=[123, 124], timestamp=12345, country="us", labeler="tom")
metadata_client.update(media_ids=[123, 124], timestamp=12345, country="us", labeler="tom")
# Output:
# {
# project_id: 1190,
Expand Down

0 comments on commit 85bb448

Please sign in to comment.