added a timezone parameter to geonames#327
Conversation
|
Hey, it's always good to see your PRs! I hope you're doing well. Actually there's a related issue discussed in #326. I even think these two might be resolved at once. As for the geopy/geopy/geocoders/googlev3.py Line 330 in a4e663a As for the
The first approach might look confusing (especially given that the two API methods, being called by the same single The second approach might look cleaner from the geocoder's interface point of view, although it may still be confusing that a geocoder provides two distinct methods both doing reverse geocoding (it is confusing to me why geoname does actually provide so many different methods which could just be parameters for a single reverse method). I haven't made up my mind yet on which way to go there, I would be glad to hear your thoughts on this one. I tend to incline towards the first option, yet I'm not certain about it. But anyway, this is out of the scope of the issue you're trying to resolve with this PR, so you may leave this out and work specifically on the timezone method instead. |
|
Hi again, sorry for the wait, I've been really busy lately.
Same goes for findNearby, but I think it doesn't matter that much or does it? |
|
This is a great question regarding the other data returned by the timezone endpoint. I see the following options:
I tend to incline towards the first option, but it would create inconsistency with the Google's timezone method. I suggest you to just keep the pytz timezone for now. I'll reason about it before the release and will probably introduce the custom wrapper. |
KostyaEsmukov
left a comment
There was a problem hiding this comment.
Don't forget that the new functionality must be covered with tests 😉!
|
Hey @Svalee, do you think you could work on this before I'd cut the next 1.18 release? If not I'd be happy to take this over so this feature could be finally published. :) |
|
@KostyaEsmukov hey, yeah, I am very sorry about this, when is 1.18 release? |
This PR is the main blocker, so as soon as it is merged.
Don't worry, it was just a friendly reminder from my side. This is fine. :) |
…ean to reverse that retertn a closest nearby toponym if checked
KostyaEsmukov
left a comment
There was a problem hiding this comment.
Thanks, I left a few comments below, could you please address them?
Also it would be nice to have the new changes of reverse method covered with tests. 😉
test/geocoders/geonames.py
Outdated
| "lang": 'en'} | ||
| ) | ||
|
|
||
| self.assertRaises( |
There was a problem hiding this comment.
Could you please refactor this to use the context manager interface?
https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertRaises
| @@ -55,20 +55,62 @@ def test_query_urlencoding(self): | |||
|
|
|||
| def test_reverse(self): | |||
There was a problem hiding this comment.
This test contains too many checks. Could you please split it to multiple distinct test methods?
test/geocoders/geonames.py
Outdated
| self.assertEqual(loc.raw['adminName1'], 'Нью-Йорк') | ||
|
|
||
| with self.assertRaises(ValueError): | ||
| self._make_request( |
There was a problem hiding this comment.
Any reason to use the raw self._make_request instead of self.reverse_run? If no such, please change to self.reverse_run.
KostyaEsmukov
left a comment
There was a problem hiding this comment.
Thanks!
Some things are still incomplete, e.g. _make_request is still being used, some versionadded directives are missing.
I'm going to merge this now as-is and will make the required corrections later, just to avoid the back-and-forth over some minor issues. The important parts are already implemented well, so it's a sufficient reason for this to be merged.
this fixes #163
Hey, it's been a while. I wasn't sure how to correctly implement this thing and I can see that there is a lot of work here to do. As far as an I can see, the timezone url is very different from geocode and reverse, however it has the same api as reverse, so I decided to put it there. I didn't write tests for this, for the same reason, I wanted to hear from you how are you seeing this timezone parameter?