Skip to content

Commit 60f7509

Browse files
committed
Resolve LogType.value within the my_logs method
1 parent a2d830b commit 60f7509

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ Get geocaches by log type
232232
for dnf in geocaching.my_dnfs(limit=2):
233233
print(dnf.name)
234234
235-
for note in geocaching.my_logs(LogType.note.value, limit=6):
235+
for note in geocaching.my_logs(LogType.note, limit=6):
236236
print(note.name)
237237
238238

pycaching/geocaching.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,13 +385,15 @@ def _cache_from_guid(self, guid):
385385
def my_logs(self, log_type=None, limit=float('inf')):
386386
"""Get an iterable of the logged-in user's logs.
387387
388-
:param log_type: The log type to search for. Use the ``.value`` attribute of a :class:`~.log.Type` value.
388+
:param log_type: The log type to search for. Use a :class:`~.log.Type` value.
389389
If set to ``None``, all logs will be returned (default: ``None``).
390390
:param limit: The maximum number of results to return (default: infinity).
391391
"""
392392
logging.info("Getting {} of my logs of type {}".format(limit, log_type))
393393
url = self._urls['my_logs']
394394
if log_type is not None:
395+
if isinstance(log_type, LogType):
396+
log_type = log_type.value
395397
url += '?lt={lt}'.format(lt=log_type)
396398
cache_table = self._request(url).find(class_='Table')
397399
if cache_table is None: # no finds on the account
@@ -414,11 +416,11 @@ def my_finds(self, limit=float('inf')):
414416
415417
:param limit: The maximum number of results to return (default: infinity).
416418
"""
417-
return self.my_logs(LogType.found_it.value, limit)
419+
return self.my_logs(LogType.found_it, limit)
418420

419421
def my_dnfs(self, limit=float('inf')):
420422
"""Get an iterable of the logged-in user's DNFs.
421423
422424
:param limit: The maximum number of results to return (default: infinity).
423425
"""
424-
return self.my_logs(LogType.didnt_find_it.value, limit)
426+
return self.my_logs(LogType.didnt_find_it, limit)

0 commit comments

Comments
 (0)