Only support modern versions of PyCountry.

This commit is contained in:
Tobias Gruetzmacher 2017-11-26 19:26:44 +01:00
parent 4d6cbf0720
commit 90685d9b0c
3 changed files with 4 additions and 5 deletions

View file

@ -5,7 +5,7 @@ from __future__ import absolute_import, division, print_function
Languages = {
'de': 'German',
'en': 'English',
'es': 'Spanish; Castilian',
'es': 'Spanish',
'fi': 'Finnish',
'fr': 'French',
'it': 'Italian',

View file

@ -343,11 +343,10 @@ class Scraper(object):
lang = languages.Languages[self.lang]
else:
try:
lang = pycountry.languages.get(alpha2=self.lang).name
lang = pycountry.languages.get(alpha_2=self.lang).name
except KeyError:
try:
lang = pycountry.languages.get(
iso639_1_code=self.lang).name
lang = pycountry.languages.get(alpha2=self.lang).name
except KeyError:
pass
return lang

View file

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam