Skip to content

pycaching.cache.Cache._from_print_page not working with non-English languages #210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Jakoma02 opened this issue Jul 23, 2023 · 1 comment

Comments

@Jakoma02
Copy link
Contributor

If the language of the webpage for the geocaching.com account is set to a different language than English, at least some parts of this package do not function correctly. For example, when the language is switched to Czech, the geocaching.my_logs(pycaching.log.Type.found_it, limit) method call raises the exception

    cache_info["summary"] = content.find("h2", text="Short Description").find_next("div").text
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'find_next'

The underlying issue seem to be that the info is parsed from the cache print page, which is retrieved in the language that the webpage UI is set to. For example, in the case of "Short Description" there is the title "Stručný popis" in the czech version instead.

@FriedrichFroebel
Copy link
Collaborator

Thanks for the report. It is a known limitation that only the English page is supported correctly. There have been some attempts to rely on "neutral" CSS classes and similar whenever parsing HTML, but this is not complete. AFAIK there does not seem to be a suitable language-independent solution for retrieving the descriptions from the print page.

Feel free to submit a PR fixing this issue if you have found a suitable solution which reliably removes the language-dependency in this case.

@FriedrichFroebel FriedrichFroebel changed the title Not working with non-English languages pycaching.cache.Cache._from_print_page not working with non-English languages Jul 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants