Closed DarkOutcast6 closed 1 year ago
Please provide a complete example (while omitting your credentials) and a complete traceback. Nevertheless, this seems to be a known issue which we cannot do much about as far as I am aware (see #182).
It is the same error as #182. If this indeed cannot be fixed, is there a workaround, such as a different search function to use instead of this one?
No: While there are three other search functions (see the API docs), they all internally rely on the same base method advanced_search
as does the regular search
method.
The problem you mentioned was fixed about half a year ago in https://github.com/tomasbedrich/pycaching/pull/206.
If you want to use the fixed version of pycaching
, you can install it with the following command:
pip install https://github.com/tomasbedrich/pycaching/archive/master.zip
pip install https://github.com/tomasbedrich/pycaching/archive/master.zip
Isn’t it released?
No, the latest version is 1.5 years old.
Shame on me. Released now.
Great! Got it working! Thanks for pushing the new release!
One final problem; the documentation states that the user can input 6 arguments into the geocaching.search()
function, but I get a code error displaying TypeError: Geocaching.search() takes from 2 to 3 positional arguments but 8 were given
when a attempt to put more then 2 arguments. Here is the code: geocaching.search(pycaching.Point.from_string(user_input),100,pycaching.geocaching.SortOrder.distance,False,100,pycaching.Point.from_string(user_input),None)
()
There is a *
in-between, id est everything besides point
and limit
needs to use keywords. Additionally, you have seven parameters instead of six ones.
I can't find anywhere in the documentation that described how I am supposed to get the cache objects that advanced_search() returns. How do I do this?
What exactly is your issue with the returned objects? advanced_search
will return you Cache
objects directly, while there might be None
entries in-between if there have been too many requests - this should be rather clear from reading the type hints which are shown in your above screenshot as well. (Depending on your limit, you might run into an infinite loop and thus the search never terminates unless you stop iterating, but your above example uses a limit of 100 which should not have this issue.)
When using the search()
function, it returns a advanced_search()
object. Should this be happening? If so, how do I access the caches from the advanced_search()
function?
Not completely correct, it returns a generator of Cache
objects and uses advanced_search
internally:
>>> import pycaching
>>> gc = pycaching.login(..., ...)
>>> gc.search(point=pycaching.Point(48, 12), limit=100)
<generator object Geocaching.advanced_search at 0x7f02c1f45bd0>
>>> list(gc.search(point=pycaching.Point(48, 12), limit=10))
[<pycaching.cache.Cache object at 0x7f02c2efece0>, <pycaching.cache.Cache object at 0x7f02c20abb20>, <pycaching.cache.Cache object at 0x7f02c20abfd0>, <pycaching.cache.Cache object at 0x7f02c1d02f80>, <pycaching.cache.Cache object at 0x7f02c1d02d70>, <pycaching.cache.Cache object at 0x7f02c1d02ef0>, <pycaching.cache.Cache object at 0x7f02c1d02ce0>, <pycaching.cache.Cache object at 0x7f02c1d03040>, <pycaching.cache.Cache object at 0x7f02c1d02dd0>, <pycaching.cache.Cache object at 0x7f02c1d02c80>]
The pycaching.geocaching.search() function not working properly.
geocaching.search(pycaching.Point.from_string("N 34° 08.433 W 118° 28.031"),100)
raises an error displayingAttributeError: 'NoneType' object has no attribute 'status_code'
(assume geocaching object is previously defined)