Collections key not found with library
See original GitHub issueI’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
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Getting an error while publishing the library - " System ...
Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary." error. This error is not specific to any xaml file, ...
Read more >Best way to handle a KeyNotFoundException - Stack Overflow
I run a bunch of keys through the dictionary, and I expect some keys to not have a value. I catch the KeyNotFoundException...
Read more >KeyNotFoundException Class (System.Collections.Generic)
A KeyNotFoundException is thrown when an operation attempts to retrieve an element from a collection using a key that does not exist in...
Read more >Collections - Robot Framework
Collections is Robot Framework's standard library that provides a set of keywords for ... Fails if key is not found from dictionary ....
Read more >collections — Container datatypes — Python 3.11.1 ...
Source code: Lib/collections/__init__.py This module implements specialized ... Lookups search the underlying mappings successively until a key is found.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think we could add some docs here, or here https://doc.scrapinghub.com/api/collections.html#access-a-record about this subject. Last week it took me a few minutes to discover that everything was ok, but the endpoint did not allow for a
/
in the key name.Given @stav PR above, I think we could work on a fix for
.get()
to always query using query string instead of pretty urls. What do you think?