-
Notifications
You must be signed in to change notification settings - Fork 60
Closed
Description
I'm curious about the difference between Collection.get()
and Collection.iter(key=[KEY])
>>> key = '456/789'
>>> store = project.collections.get_store('trump')
>>> store.set({'_key': key, 'value': 'abc'})
>>> print(store.list(key=[key]))
[{'value': 'abc', '_key': '456/789'}] # https://storage.scrapinghub.com/collections/9328/s/trump?key=456%2F789&meta=_key
>>> try:
>>> print(store.get(key))
>>> except scrapinghub.client.exceptions.NotFound as e:
>>> print(getattr(e, 'http_error', e))
404 Client Error: Not Found for url: https://storage.scrapinghub.com/collections/9328/s/trump/456/789
I assume that Collection.get()
is a handy shortcut for the key-filtered .iter()
function so I guess the point of my issue is that .get()
will raise an exception if given bad input, for example slashes
Metadata
Metadata
Assignees
Labels
No labels