Merge lp:~marco-gallotta/ibid/timezone-543989 into lp:~ibid-core/ibid/old-trunk-1.6

Proposed by marcog
Status: Superseded
Proposed branch: lp:~marco-gallotta/ibid/timezone-543989
Merge into: lp:~ibid-core/ibid/old-trunk-1.6
Diff against target: 27 lines (+3/-3)
1 file modified
ibid/plugins/geography.py (+3/-3)
To merge this branch: bzr merge lp:~marco-gallotta/ibid/timezone-543989
Reviewer Review Type Date Requested Status
Michael Gorven Approve
Review via email: mp+21839@code.launchpad.net

This proposal has been superseded by a proposal from 2010-03-22.

Description of the change

Add username=ibid field for geonames ws. See http://geonames.wordpress.com/2010/03/16/ddos-part-ii/ for why this is necessary.

To post a comment you must log in.
914. By marcog

Add username arg to other geonames calls, even though they're not required

Revision history for this message
Michael Gorven (mgorven) wrote :

 review approve

review: Approve

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ibid/plugins/geography.py'
2--- ibid/plugins/geography.py 2010-03-10 19:32:04 +0000
3+++ ibid/plugins/geography.py 2010-03-22 10:18:25 +0000
4@@ -52,7 +52,7 @@
5 radius_values = DictOption('radius_values', 'Radius of the earth in the units in which to specify distances', default_radius_values)
6
7 def get_place_data(self, place, num):
8- return json_webservice('http://ws.geonames.org/searchJSON', {'q': place, 'maxRows': num})
9+ return json_webservice('http://ws.geonames.org/searchJSON', {'q': place, 'maxRows': num, 'username': 'ibid'})
10
11 def get_place(self, place):
12 js = self.get_place_data(place, 1)
13@@ -319,12 +319,12 @@
14 raise TimezoneException(u"I don't know about the %s timezone" % (string,))
15
16 def _geonames_lookup(self, place):
17- search = json_webservice('http://ws.geonames.org/searchJSON', {'q': place, 'maxRows': 1})
18+ search = json_webservice('http://ws.geonames.org/searchJSON', {'q': place, 'maxRows': 1, 'username': 'ibid'})
19 if search['totalResultsCount'] == 0:
20 return None
21
22 city = search['geonames'][0]
23- timezone = json_webservice('http://ws.geonames.org/timezoneJSON', {'lat': city['lat'], 'lng': city['lng']})
24+ timezone = json_webservice('http://ws.geonames.org/timezoneJSON', {'lat': city['lat'], 'lng': city['lng'], 'username': 'ibid'})
25
26 if 'timezoneId' in timezone:
27 return gettz(timezone['timezoneId'])

Subscribers

People subscribed via source and target branches