Skip to content
Browse files

Merge remote-tracking branch 'iskachkov/master'

  • Loading branch information...
2 parents 4e379da + b569135 commit d1ad4a0694ae6853f8cc9c8ee8af217e2b817511 @palewire palewire committed Jun 27, 2012
Showing with 11 additions and 1 deletion.
  1. +2 −0 .gitignore
  2. +4 −1 googlegeocoder/__init__.py
  3. +5 −0 tests.py
View
2 .gitignore
@@ -1 +1,3 @@
*.pyc
+
+.idea/*
View
5 googlegeocoder/__init__.py
@@ -23,7 +23,8 @@ def _fetch_json(self, params):
response = urllib2.urlopen(request)
return json.loads(response.read())
- def get(self, submission, sensor='false', bounding_box=None, region=None):
+ def get(self, submission, sensor='false', bounding_box=None, region=None,
+ language=None):
params = {'sensor': sensor}
if isinstance(submission, basestring):
params['address'] = submission
@@ -41,6 +42,8 @@ def get(self, submission, sensor='false', bounding_box=None, region=None):
)
if region:
params['region'] = region
+ if language:
+ params['language'] = language
data = self._fetch_json(params)
if data["status"] != "OK":
raise ValueError(data["status"])
View
5 tests.py 100644 → 100755
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+# -*- coding: utf-8 -*-
import unittest
from googlegeocoder import *
from pprint import pprint
@@ -45,6 +46,10 @@ def test_region_bias(self):
result = self.geocoder.get("Toledo", region='ES')
self.assertEqual(result[0].formatted_address, u'Toledo, Spain')
+ def test_language(self):
+ result = self.geocoder.get('Moscow', language='ru')
+ self.assertEqual(result[0].formatted_address, u'Москва, Россия')
+
if __name__ == '__main__':
unittest.main()

0 comments on commit d1ad4a0

Please sign in to comment.
Something went wrong with that request. Please try again.