Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Pycaching has following requirements:

Python>=3.5
requests>=2.8
beautifulsoup4>=4.4
beautifulsoup4>=4.9
geopy>=1.11

Pycaching tests have the following additional requirements:
Expand All @@ -66,7 +66,7 @@ Examples
Login
---------------------------------------------------------------------------------------------------

Simly call `pycaching.login()
Simply call `pycaching.login()
<https://pycaching.readthedocs.io/en/latest/api.html#pycaching.geocaching.Geocaching.login>`__
method and it will do everything for you.

Expand Down Expand Up @@ -179,7 +179,7 @@ Search for all traditional caches around

Notice the ``limit`` in the search function. It is because `geocaching.search()
<https://pycaching.readthedocs.io/en/latest/api.html#pycaching.geocaching.Geocaching.search>`__
returns a generator object, which would fetch the caches forever in case of simple loop.
returns a generator object, which would fetch the caches forever in case of a simple loop.

Geocode adress and search around
---------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -210,7 +210,7 @@ Find caches with their approximate locations in some area
print(cache.name, cache.location.precision)


Load a trackable details
Load trackable details
---------------------------------------------------------------------------------------------------

.. code-block:: python
Expand Down Expand Up @@ -272,6 +272,10 @@ Substitute your username for ``yourusername`` and your password for ``yourpasswo
have exported the environment variables once, you do not need to export them again, and can run
tests with just ``python3 setup.py test``.

To re-record a specific cassette in case of site changes, delete the corresponding JSON file and
provide username and password as explained above. The missing cassette will be recorded for future
usages.

.. _appendix:

Appendix
Expand Down
3 changes: 2 additions & 1 deletion pycaching/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import re
import enum
import os
from bs4.element import Script
from pycaching import errors
from pycaching.geo import Point
from pycaching.trackable import Trackable
Expand Down Expand Up @@ -737,7 +738,7 @@ def load(self):
else:
self.favorites = 0

js_content = "\n".join(map(lambda i: i.text, root.find_all("script")))
js_content = "\n".join(root.find_all(string=lambda i: isinstance(i, Script)))
self._logbook_token = re.findall("userToken\\s*=\\s*'([^']+)'", js_content)[0]
# find original location if any
if "oldLatLng\":" in js_content:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def run(self):
"description": "Geocaching.com site crawler. Provides tools for searching, fetching caches and geocoding.",
"long_description": long_description,
"keywords": ["geocaching", "crawler", "geocache", "cache", "search", "geocode", "travelbug"],
"install_requires": ["requests>=2.8", "beautifulsoup4>=4.4", "geopy>=1.11"],
"install_requires": ["requests>=2.8", "beautifulsoup4>=4.9", "geopy>=1.11"],
"tests_require": ["betamax >=0.8, <0.9", "betamax-serializers >=0.2, <0.3"],
"setup_requires": ["nose", "flake8<3.0.0", "coverage"], # flake8 >= 3.0 has incompatible API
"cmdclass": {"test": NoseTestCommand, "lint": LintCommand},
Expand Down