Skip to content
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

Feature/delete duplicates #301

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
apply suggested changes by @jmathai
DZamataev committed Dec 28, 2018
commit 120b475ba15940403675de47f342c4ea8553e0e5
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
@@ -342,7 +342,7 @@ cp config.ini-sample ~/.elodie/config.ini
# now you're ready to add your MapQuest key
```

You may also prefer your locations to be named in English language, not the local language. Then just set the following key in `config.ini` like so: `prefer_english_names=True`.
If you're an english speaker then you will probably want to add `prefer_english_names=True` to the `[MapQuest]` section else you'll have cities named using the local language.

## Questions, comments or concerns?

7 changes: 4 additions & 3 deletions elodie/geolocation.py
Original file line number Diff line number Diff line change
@@ -131,8 +131,7 @@ def get_prefer_english_names():
if('prefer_english_names' not in config['MapQuest']):
return False

s = config['MapQuest']['prefer_english_names']
__PREFER_ENGLISH_NAMES__ = s in ['True', 'true', '1', 't', 'y', 'yes', 'Yes']
__PREFER_ENGLISH_NAMES__ = bool(config['MapQuest']['prefer_english_names'])
return __PREFER_ENGLISH_NAMES__

def place_name(lat, lon):
@@ -202,7 +201,9 @@ def lookup(**kwargs):
path,
urllib.parse.urlencode(params)
)
headers = {'Accept-Language':'en-EN,en;q=0.8'} if prefer_english_names else {}
headers = {}
if(prefer_english_names):
headers = {'Accept-Language':'en-EN,en;q=0.8'}
r = requests.get(url, headers=headers)
return parse_result(r.json())
except requests.exceptions.RequestException as e: