tomasbedrich / pycaching Goto Github PK
View Code? Open in Web Editor NEWA Python 3 interface for working with Geocaching.com website.
Home Page: https://pycaching.readthedocs.io/
License: GNU Lesser General Public License v3.0
A Python 3 interface for working with Geocaching.com website.
Home Page: https://pycaching.readthedocs.io/
License: GNU Lesser General Public License v3.0
vagrant@vagrant:~$ ./env/bin/python
Python 3.5.2 (default, Jul 5 2016, 12:43:10)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
import sys, datetime, pycaching, logging, time
from pycaching.log import Log, Type as LogType
logging.basicConfig(filename='tblog.log',level=logging.DEBUG)
trcode='PLE556'
geocaching = pycaching.login()
trackable = geocaching.get_trackable(trcode)
trackable
<pycaching.trackable.Trackable object at 0x7fc4497cc7b8>
trackable.name
Traceback (most recent call last):
File "/home/vagrant/env/lib/python3.5/site-packages/pycaching/util.py", line 26, in wrapper
return func(*args, **kwargs)
File "/home/vagrant/env/lib/python3.5/site-packages/pycaching/trackable.py", line 79, in name
return self._name
AttributeError: 'Trackable' object has no attribute '_name'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "/home/vagrant/env/lib/python3.5/site-packages/pycaching/util.py", line 30, in wrapper
self.load()
File "/home/vagrant/env/lib/python3.5/site-packages/pycaching/trackable.py", line 199, in load
if "cache_details" in location_url:
TypeError: argument of type 'NoneType' is not iterable
also:
print(trackable.name, trackable.goal, trackable.description, trackable.location)
Traceback (most recent call last):
File "/home/vagrant/env/lib/python3.5/site-packages/pycaching/util.py", line 26, in wrapper
return func(*args, **kwargs)
File "/home/vagrant/env/lib/python3.5/site-packages/pycaching/trackable.py", line 95, in location
return self._location
AttributeError: 'Trackable' object has no attribute '_location'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "/home/vagrant/env/lib/python3.5/site-packages/pycaching/util.py", line 30, in wrapper
self.load()
File "/home/vagrant/env/lib/python3.5/site-packages/pycaching/trackable.py", line 199, in load
if "cache_details" in location_url:
TypeError: argument of type 'NoneType' is not iterable
Event-caches are marked as "not found", because the corresponding text is "Attended" and not "Found it!"
-- Uwe Zimmermann
At the moment, when using load_cache()
to retrieve a premium cache details with a free account, a PMOnlyException
exception is thrown.
It would be great to fetch the available cache informations:
Thank you!
>>> import pycaching
>>> from pycaching import Geocaching, Point
>>> point = Point(10.123456, 10.123456)
>>> geocaching = Geocaching()
>>> geocaching.login("cache-map", "pGUgNw59")
>>> for cache in geocaching.search(point, limit=50):
... if cache.cache_type == "Traditional Cache":
... print(cache.name)
...
Bauchi Park Cache
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/ricoo/Drive/sites/other/utilities/pycaching/pycaching/geocaching.py", line 159, in search
page = self._search_get_page(point, page_num)
File "/Users/ricoo/Drive/sites/other/utilities/pycaching/pycaching/geocaching.py", line 42, in wrapper
return func(*args, **kwargs)
File "/Users/ricoo/Drive/sites/other/utilities/pycaching/pycaching/geocaching.py", line 193, in _search_get_page
post["__EVENTTARGET"] = self._pagging_postbacks[page_num]
KeyError: 2
>>>
As reported by few people - the Cache object cannot be loaded because of Unknown date format
.
This error is caused because of Groundspeak has added new date formats:
In meantime affected users can either set another date format in their user profile or wait for a next release.
Some caches provides a list of additional waypoints (GC58QHM, GCMNF7).
The additional waypoints are commonly used for adding coordinates for Parking areas, steps in multi caches and similar things.
The additional waypoints list contains the following columns for each waypoint
My suggestion is that a light object is created (perhaps a namedtuple
) with at least Type, Lookup, Name, Coordinate and Note fields.
Either the list is converted to a dict with the Lookup (name is not unique) as key or as a plain list.
I will submit a pull request referencing this issue with a simple implementation.
Problem: It is annoying and even unsafe to enter your login credentials every time again when using pycaching from interactive interpreter.
Solution: allow pycaching to load username and password from .rc file stored in user's home directory. I would propose a filename .geocaching_credentials
in a JSON format. Then a task would be to update Geocaching.login
method to have username
and password
parameters optional and use .rc file instead. In case that neither parameters were passed nor .rc file exists, it would raise an error.
Use this URL: http://www.geocaching.com/seek/cdpf.aspx?guid=182a3463-e46e-4401-8697-3ad3ac2a1a42&lc=10 to parse geocache data (possible 2 times speedup).
When accessing a trackable page via web browser I am able to download the route of the specified trackable as a KML file. Could be very helpful to enable an automated download of these routes (saving them as files would be enough from my point of view).
Seems like the download link could be parsed using id="ctl00_ContentBody_lnkGoogleKML"
.
I'm looking for a function to get the list a found and not found caches.
These lists are available through the URL 'my/logs.aspx?s=1<=2' and 'my/logs.aspx?s=1<=2' but each cache is referenced as a GUID, not as a GC code.
(My final purpose is to retrieve the position of all my found/not found caches to draw a map)
Describe:
.editorconfig
fileValueError points to line 1112 in cache.py:
in from_string return cls(name) File "/usr/lib/python3.6/enum.py", line 291, in __call__ return cls.__new__(cls, value) File "/usr/lib/python3.6/enum.py", line 533, in __new__ return cls._missing_(value) File "/usr/lib/python3.6/enum.py", line 546, in _missing_ raise ValueError("%r is not a valid %s" % (value, cls.__name__)) ValueError: 'střední' is not a valid Size
get_cache method works ok.
T. Pavelka
Loading the waypoints of some caches fails in parsing with an AttributeError
. I only have one example (from the tests), but someone should look into whether this applies to all caches, or something like all archive caches.
Steps to reproduce:
In [1]: import pycaching
In [2]: gc = pycaching.login('REDACTED', 'REDACTED')
In [3]: cache = gc.get_cache('GC2WXPN')
In [4]: cache.waypoints
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pycaching/util.py in wrapper(*args, **kwargs)
25 try:
---> 26 return func(*args, **kwargs)
27 except AttributeError:
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pycaching/cache.py in waypoints(self)
274 """
--> 275 return self._waypoints
276
AttributeError: 'Cache' object has no attribute '_waypoints'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
<ipython-input-4-d0929eb115a1> in <module>()
----> 1 cache.waypoints
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pycaching/util.py in wrapper(*args, **kwargs)
28 logging.debug("Lazy loading {} into <object {} id {}>".format(
29 func.__name__, type(self), id(self)))
---> 30 self.load()
31 return func(*args, **kwargs) # try to return it again
32
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pycaching/cache.py in load(self)
680
681 # Additional Waypoints
--> 682 self.waypoints = Waypoint.from_html(root, "ctl00_ContentBody_Waypoints")
683
684 logging.debug("Cache loaded: {}".format(self))
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pycaching/cache.py in from_html(cls, soup, table_id)
954 columns = r1.find_all("td") + r2.find_all("td")
955 identifier = columns[4].text.strip()
--> 956 type = columns[2].find("img").get("title")
957 location_string = columns[6].text.strip()
958 try:
AttributeError: 'NoneType' object has no attribute 'get'
It seems Groundspeak has altered the formatting of the cache print pages.
I believe that changing this line:
Line 956 in e257356
to type = columns[1].find("img").get("title")
and this line:
Line 964 in e257356
to note = columns[7].text.strip()
will fix the issue, but I've only tested that with this one cache.
If there is no long description for the cache listed on the website, cache.description returns
<div class="UserSuppliedContent">
<span id="ctl00_ContentBody_LongDescription"></span>
</div>
This should be handled gracefully, and just return an empty string. I will put in a pull request for this when I fix it (see #78)
It is painful to filter caches by sizes or types. Groundspeak often changes the data, eg. "Traditional Cache" to "Traditional" and the filtering code then would have to be rewritten.
It would be better to encapsulate string data to some kind of enum, that would remain unchanged when underlaying strings would change.
The search now returns this error::
File "geosearch.py", line 7, in <module>
for cache in geocaching.search(point, limit=50):
File "/home/alex/.virtualenvs/pycaching/lib/python3.4/site-packages/pycaching/geocaching.py", line 138, in search
page = self._search_get_page(point, page_num)
File "/home/alex/.virtualenvs/pycaching/lib/python3.4/site-packages/pycaching/geocaching.py", line 21, in wrapper
return func(*args, **kwargs)
File "/home/alex/.virtualenvs/pycaching/lib/python3.4/site-packages/pycaching/geocaching.py", line 198, in _search_get_page
return [self._search_parse_cache(c) for c in data]
File "/home/alex/.virtualenvs/pycaching/lib/python3.4/site-packages/pycaching/geocaching.py", line 198, in <listcomp>
return [self._search_parse_cache(c) for c in data]
File "/home/alex/.virtualenvs/pycaching/lib/python3.4/site-packages/pycaching/geocaching.py", line 21, in wrapper
return func(*args, **kwargs)
File "/home/alex/.virtualenvs/pycaching/lib/python3.4/site-packages/pycaching/geocaching.py", line 225, in _search_parse_cache
c.hidden = Util.parse_date(placed.text)
File "/home/alex/.virtualenvs/pycaching/lib/python3.4/site-packages/pycaching/util.py", line 38, in parse_date
raise errors.ValueError("Unknown date format.")
It is probably due to the recent changes in GC.com (change in the location of the user preferences, so the date formats are misinterpreted).
Warning reported on WIndows x64:
Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:16:59) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import pycaching
g = pycaching.login("user","pass")C:\Program Files (x86)\Python 3.5\lib\site-packages\bs4__init__.py:166: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("html.parser"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.
To get rid of this warning, change this:
BeautifulSoup([your markup])
to this:
BeautifulSoup([your markup], "html.parser") markup_type=markup_type))
The original coordinates are located in the javascript data block as "oldLatLng".
-- Uwe Zimmermann
Use this URL: http://www.geocaching.com/seek/geocache.logbook?tkn=2XTN3PAW6BOQF344SAYTREXPUPL54A7EI3773SIWYGHUZM3TB6GMCU45WFOOO2DXP5PFNRLZ26W2BHCYH3V3GLKCTDH6MAPYNNTJFKBNFYGUDTVO6SSIX66LQPKDGSU2L5UZ2CH5JF7VH3GXKZKN2WNL24&idx=2&num=10&sp=false&sf=false&decrypt=false
The above is just XHR-requested URL from http://www.geocaching.com/seek/cache_logbook.aspx?guid=182a3463-e46e-4401-8697-3ad3ac2a1a42
Groundspeak changed the dimensions of UTFGrid Block
s from 3 to 6. As a result, Block._get_corrected_limits
doesn't work, therefore the whole search_quick
doesn't work either.
See https://tiles01.geocaching.com/map.info?x=8800&y=5574&z=14
>>> cache = geocaching.load_cache("GC12345")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.2/dist-packages/pycaching/geocaching.py", line 21, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.2/dist-packages/pycaching/geocaching.py", line 320, in load_cache
c.cache_type = cache_type
File "/usr/local/lib/python3.2/dist-packages/pycaching/cache.py", line 231, in cache_type
raise ValueError("Cache type '{}' is not possible.".format(cache_type))
pycaching.errors.ValueError: Cache type 'Cache Mystère' is not possible.
(my geocaching.com account is in French)
Hi,
I'd like to know if it was reasonably possible to add support for creating (or simply editing existing) notifications. My personal need/ use case consists updating coordinates of FTF notifications whenever I change my location and I've done some experimentation how to make this straight forward by using additional tools.
cache.py uses
Example:
http://tiles01.geocaching.com/map.details?i=GCed345a
The LoadError that is raised in geocaching.py:404 excepts because of a KeyError on the 'msg' which is absent.
So, @mkouhia, I've finally merged your work into the dev branch.
But before we can move forward, please try to fix an error on geocaching.py:360
(undefined variable new_zoom
).
As I've walked through your code I've noticed, that it may be useful to create one more object – a Tile – to encapsulate (x, y, z) tuples and methods for working with tiles. What do you think?
I tried installing the package, and got the following error:
Collecting pycaching
Using cached https://files.pythonhosted.org/packages/e1/b8/dab5c9432d1af40f03fce718d05fc8fdc1588f88f724871d208460fde535/pycaching-3.6.3.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\MYUSERNAME\AppData\Local\Temp\pycharm-packaging\pycaching\setup.py", line 43, in <module>
with (root / "requirements.txt").open(encoding="utf-8") as f:
File "C:\Python36\lib\pathlib.py", line 1164, in open
opener=self._opener)
File "C:\Python36\lib\pathlib.py", line 1018, in _opener
return self._accessor.open(self, flags, mode)
File "C:\Python36\lib\pathlib.py", line 390, in wrapped
return strfunc(str(pathobj), *args)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\MYUSERNAME\\AppData\\Local\\Temp\\pycharm-packaging\\pycaching\\requirements.txt'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\MYUSERNAME\AppData\Local\Temp\pycharm-packaging\pycaching\
this happened on my friend's computer too. Has something maybe broken in the package files? am I doing it wrong? any workaround?
Thanks
I always have a bad feeling about storing passwords in plain text, which is why I use a password store to save my passwords gpg encrypted (GNU pass in my case). Since most of these password managers feature a command line interface I think it would be a nice feature to set an appropriate password-retrieval command in the config file mutually exclusive with plain-text password option.
When calling python setup.py lint
after cloning the repo (as described in CONTRIBUTING.rst), I get some error messages.
Calling flake8 ---version
displays 2.6.2 (pycodestyle: 2.0.0, pyflakes: 1.2.3, mccabe: 0.5.2) CPython 3.6.0a3 on Windows
.
The error message which is repeated some times:
running lint
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Python\lib\multiprocessing\spawn.py", line 106, in spawn_main
exitcode = _main(fd)
File "C:\Python\lib\multiprocessing\spawn.py", line 115, in _main
prepare(preparation_data)
File "C:\Python\lib\multiprocessing\spawn.py", line 226, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "C:\Python\lib\multiprocessing\spawn.py", line 278, in _fixup_main_from_path
run_name="__mp_main__")
File "C:\Python\lib\runpy.py", line 254, in run_path
pkg_name=pkg_name, script_name=fname)
File "C:\Python\lib\runpy.py", line 93, in _run_module_code
with _TempModule(mod_name) as temp_module, _ModifiedArgv0(fname):
File "C:\Python\lib\runpy.py", line 54, in __enter__
self._saved_value = sys.argv[0]
IndexError: list index out of range
Add attribute touristOK
WARNING:root:Unknown attribute 'touristOK', ignoring.
While posting log, some input don't have a value field.
Ex: ctl00$ContentBody$LogBookPanel1$uxTrackables$hdnSelectedActions
Hi,
I've experimented with the library for a while and I think I observed with some random behaviour with trackable.post_log. To me, it seems to work on/off, i.e. sometimes logging tbs is successful and some other time not.
Has anyone noticed similar behaviour? I think I can give an example of at least couple of TBs (TB5ZBY7) which fail to log.
By increasing log level I get
DEBUG:requests.packages.urllib3.connectionpool:"GET /track/details.aspx?tracker=XXXXXX HTTP/1.1" 200 68978
DEBUG:requests.packages.urllib3.connectionpool:"GET /track/log.aspx?wid=a9c1fca6-4b8c-4235-9ed4-a7cb7ab9257d&c=XXXXXX HTTP/1.1" 200 58194
DEBUG:requests.packages.urllib3.connectionpool:"POST /track/log.aspx?wid=a9c1fca6-4b8c-4235-9ed4-a7cb7ab9257d&c=XXXXXX HTTP/1.1" 200 58151
when it fails and
DEBUG:requests.packages.urllib3.connectionpool:"GET /track/details.aspx?tracker=XXXXXX HTTP/1.1" 200 69202
DEBUG:requests.packages.urllib3.connectionpool:"GET /track/log.aspx?wid=a9c1fca6-4b8c-4235-9ed4-a7cb7ab9257d&c=XXXXXX HTTP/1.1" 200 58194
DEBUG:requests.packages.urllib3.connectionpool:"POST /track/log.aspx?wid=a9c1fca6-4b8c-4235-9ed4-a7cb7ab9257d&c=XXXXXX HTTP/1.1" 302 158
DEBUG:requests.packages.urllib3.connectionpool:"GET /track/log.aspx?LogReferenceCode=YYYYYYYY HTTP/1.1" 200 53937
when it succeeds. TB logging code is hidden in above but I used the same one both times - PM if you wish to test this.
If a user posts a DNF (didn't not find) or a note on geocaching.com, pychaching reports that cache is if it was "found" by that user.
As the title says. Cache.description
returns only the long description. Based on a search of the documentation, there seems to be no way to access short descriptions. Can this be added?
Traceback (most recent call last):
File "", line 1, in
File "build/bdist.macosx-10.8-intel/egg/pycaching/geocaching.py", line 124, in search
File "build/bdist.macosx-10.8-intel/egg/pycaching/geocaching.py", line 155, in _searchGetPage
KeyError: 11
For Event-caches there is no field for favorite points so the code fails.
-- Uwe Zimmermann
When the geocache account is set to another language than English, any request involving seeking cache info fails.
Example of code that fails (taken from docs):
point = Point(56.25263, 15.26738)
for cache in geocaching.search(point, limit=50):
if cache.type == Type.traditional:
print(cache.name)
Yields:
pycaching.errors.ValueError: Unknown cache size
Works as expected with user's preference set to English.
Load any cache as c
and run the following:
for l in c.load_logbook():
print('{} by {} ({}):\n\n{}'.format(l.type, l.author, l.visited, l.text))
All logs will output successfully, until the end, when the following exception is raised: pycaching.errors.ValueError: Unknown log type '24'.
.
By visiting https://www.geocaching.com/images/logtypes/24.png, one can see that log type '24' is 'Publish Listing'. Can this be added?
Maybe it's a good idea to allow tracking codes besides the trackable id. Currently there seems to be a check for the first two characters of the given code and therefore inserting a tracking code fails.
The URL is the same as far as I know.
Move methods like load_cache
and load_trackable
(and helpers) to Cache and Trackable objects as classmethods.
While parsing French caches (that contains non ascii chars in the hint), the rot13 function crashes.
File "build/bdist.macosx-10.7-x86_64/egg/pycaching/geocaching.py", line 303, in loadCache
File "build/bdist.macosx-10.7-x86_64/egg/pycaching/util.py", line 86, in rot13decode
File "/Users/driquet/git/geotrails/venv/lib/python2.7/encodings/rot_13.py", line 20, in decode
return codecs.charmap_decode(input,errors,decoding_map)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe8' in position 9: ordinal not in range(128)
Not good. Probably some new kind of protection...
[pycaching] ricoo@pro ~/work/pycaching master $ ./setup.py nosetests --tests test.test_geocaching.TestMethods
running nosetests
running egg_info
writing top-level names to pycaching.egg-info/top_level.txt
writing pycaching.egg-info/PKG-INFO
writing dependency_links to pycaching.egg-info/dependency_links.txt
writing requirements to pycaching.egg-info/requires.txt
reading manifest file 'pycaching.egg-info/SOURCES.txt'
writing manifest file 'pycaching.egg-info/SOURCES.txt'
test_search (test.test_geocaching.TestMethods) ... ok
Perform search and check found caches ... FAIL
Test if search results matches exact cache locations. ... ok
======================================================================
FAIL: Perform search and check found caches
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/ricoo/ownCloud/work/pycaching/test/test_geocaching.py", line 47, in test_search_quick
self.assertIn(wp, res)
AssertionError: 'GC41FJC' not found in []
"""Fail immediately, with the given message."""
>> raise self.failureException("'GC41FJC' not found in []")
-------------------- >> begin captured logging << --------------------
root: INFO: Searching quick in <pycaching.geo.Rectangle object at 0x10529ff60>
root: DEBUG: Area converted to 1 tiles, zoom level 14
root: DEBUG: Lazy loading blocks into <object <class 'pycaching.geo.Tile'> id 4379866560>
root: DEBUG: Downloading UTFGrid for <object Tile, id 4379866560, coords (8800, 5574, 14)>
root: DEBUG: Getting UTFGrid
requests.packages.urllib3.connectionpool: INFO: Starting new HTTP connection (1): tiles01.geocaching.com
requests.packages.urllib3.connectionpool: DEBUG: "GET /map.info?x=8800&z=14&y=5574 HTTP/1.1" 204 0
root: DEBUG: Cannot load UTFgrid: no content. Trying to load .png tile first
root: DEBUG: Downloading UTFGrid for <object Tile, id 4379866560, coords (8800, 5574, 14)>
root: DEBUG: Getting .png file
requests.packages.urllib3.connectionpool: DEBUG: "GET /map.png?x=8800&z=14&y=5574 HTTP/1.1" 200 9447
root: DEBUG: Getting UTFGrid
requests.packages.urllib3.connectionpool: DEBUG: "GET /map.info?x=8800&z=14&y=5574 HTTP/1.1" 204 0
root: DEBUG: There is really no content! Returning 0 caches.
root: DEBUG: No block loaded to <object Tile, id 4379866560, coords (8800, 5574, 14)>
root: DEBUG: Lazy loading blocks into <object <class 'pycaching.geo.Tile'> id 4392281480>
root: DEBUG: Downloading UTFGrid for <object Tile, id 4392281480, coords (8800, 5575, 14)>
root: DEBUG: Getting UTFGrid
requests.packages.urllib3.connectionpool: DEBUG: "GET /map.info?x=8800&z=14&y=5575 HTTP/1.1" 204 0
root: DEBUG: Cannot load UTFgrid: no content. Trying to load .png tile first
root: DEBUG: Downloading UTFGrid for <object Tile, id 4392281480, coords (8800, 5575, 14)>
root: DEBUG: Getting .png file
requests.packages.urllib3.connectionpool: DEBUG: "GET /map.png?x=8800&z=14&y=5575 HTTP/1.1" 200 5588
root: DEBUG: Getting UTFGrid
requests.packages.urllib3.connectionpool: DEBUG: "GET /map.info?x=8800&z=14&y=5575 HTTP/1.1" 204 0
root: DEBUG: There is really no content! Returning 0 caches.
root: DEBUG: No block loaded to <object Tile, id 4392281480, coords (8800, 5575, 14)>
root: DEBUG: Lazy loading blocks into <object <class 'pycaching.geo.Tile'> id 4379866560>
root: DEBUG: Downloading UTFGrid for <object Tile, id 4379866560, coords (8801, 5574, 14)>
root: DEBUG: Getting UTFGrid
requests.packages.urllib3.connectionpool: DEBUG: "GET /map.info?x=8801&z=14&y=5574 HTTP/1.1" 204 0
root: DEBUG: Cannot load UTFgrid: no content. Trying to load .png tile first
root: DEBUG: Downloading UTFGrid for <object Tile, id 4379866560, coords (8801, 5574, 14)>
root: DEBUG: Getting .png file
requests.packages.urllib3.connectionpool: DEBUG: "GET /map.png?x=8801&z=14&y=5574 HTTP/1.1" 200 4799
root: DEBUG: Getting UTFGrid
requests.packages.urllib3.connectionpool: DEBUG: "GET /map.info?x=8801&z=14&y=5574 HTTP/1.1" 204 0
root: DEBUG: There is really no content! Returning 0 caches.
root: DEBUG: No block loaded to <object Tile, id 4379866560, coords (8801, 5574, 14)>
root: DEBUG: Lazy loading blocks into <object <class 'pycaching.geo.Tile'> id 4379866616>
root: DEBUG: Downloading UTFGrid for <object Tile, id 4379866616, coords (8801, 5575, 14)>
root: DEBUG: Getting UTFGrid
requests.packages.urllib3.connectionpool: DEBUG: "GET /map.info?x=8801&z=14&y=5575 HTTP/1.1" 204 0
root: DEBUG: Cannot load UTFgrid: no content. Trying to load .png tile first
root: DEBUG: Downloading UTFGrid for <object Tile, id 4379866616, coords (8801, 5575, 14)>
root: DEBUG: Getting .png file
requests.packages.urllib3.connectionpool: DEBUG: "GET /map.png?x=8801&z=14&y=5575 HTTP/1.1" 200 5193
root: DEBUG: Getting UTFGrid
requests.packages.urllib3.connectionpool: DEBUG: "GET /map.info?x=8801&z=14&y=5575 HTTP/1.1" 204 0
root: DEBUG: There is really no content! Returning 0 caches.
root: DEBUG: No block loaded to <object Tile, id 4379866616, coords (8801, 5575, 14)>
--------------------- >> end captured logging << ---------------------
----------------------------------------------------------------------
Ran 3 tests in 31.256s
FAILED (failures=1)
[pycaching] ricoo@pro ~/work/pycaching master $ ./setup.py nosetests --tests test.test_geocaching.TestMethods
running nosetests
running egg_info
writing requirements to pycaching.egg-info/requires.txt
writing pycaching.egg-info/PKG-INFO
writing top-level names to pycaching.egg-info/top_level.txt
writing dependency_links to pycaching.egg-info/dependency_links.txt
reading manifest file 'pycaching.egg-info/SOURCES.txt'
writing manifest file 'pycaching.egg-info/SOURCES.txt'
test_search (test.test_geocaching.TestMethods) ... ok
Perform search and check found caches ... ok
Test if search results matches exact cache locations. ... ok
----------------------------------------------------------------------
Ran 3 tests in 32.127s
OK
when running python3 setup.py lint
I get a lot of errors in ./sphinxdoc/source/conf.py
The errors are mostly
E265 block comment should start with '# '
and a couple of unused imports.
should the file (or maybe the entire sphinxdoc directory) be excluded from lint or should the errors be corrected?
In lines 73-76 of geo.py, the degree portion of coordinates is converted to negative if the corresponding measure is in the Southern Hemisphere or the Western Hemisphere. On line 78, the degree and minute components of the latitude and longitude are passed on to a function which converts them to decimal degree format. In that function, the degree component is added to the minute component over sixty. However, when the coordinates are in the Southern Hemisphere or the Western Hemisphere, the degree component of one or both coordinates is negative, but the corresponding minute component is positive. This has the unintended effect of converting Southern or Western coordinates by the formula –(degree – (minute/60))
, when the correct formula would be –(degree + (minute/60))
.
I believe this problem is a two-line fix. The previously linked code block(73-76 of geo.py) should be changed to the following:
if "S" in string:
latDeg *= -1
latMin *= -1
if "W" in string:
lonDeg *= -1
lonMin *= -1
This converts both the degree and minute portions of the coordinate to negative numbers, so that they can be added to increase the absolute value of the result, as intended.
This bug seems to have been introduced two years ago. I suspect the author never noticed it, as he appears to live in the Czech Republic, which is in the Northern and Eastern Hemispheres. 😜
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.