summaryrefslogtreecommitdiff
path: root/utils/fetch_currencies.py
diff options
context:
space:
mode:
authorNoémi Ványi <kvch@users.noreply.github.com>2020-09-12 14:51:35 +0200
committerGitHub <noreply@github.com>2020-09-12 14:51:35 +0200
commit2370234d0978f59dd62efa4a4931e41ad31444d1 (patch)
treed3863e22b3d34092484146ce0bdc6e0ca8d36216 /utils/fetch_currencies.py
parent272158944bf13503e2597018fc60a00baddec660 (diff)
parentbdac99d4f0349a71d7ecb9a4c61687356afedd6b (diff)
Merge pull request #2137 from dalf/drop-python-2
Drop Python 2
Diffstat (limited to 'utils/fetch_currencies.py')
-rw-r--r--utils/fetch_currencies.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/utils/fetch_currencies.py b/utils/fetch_currencies.py
index 5605fb387..437c375db 100644
--- a/utils/fetch_currencies.py
+++ b/utils/fetch_currencies.py
@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
-from __future__ import print_function
+
import json
import re
import unicodedata
import string
-from urllib import urlencode
+from urllib.parse import urlencode
from requests import get
languages = {'de', 'en', 'es', 'fr', 'hu', 'it', 'nl', 'jp'}
@@ -39,7 +39,7 @@ def add_currency_name(name, iso4217):
db_names = db['names']
- if not isinstance(iso4217, basestring):
+ if not isinstance(iso4217, str):
print("problem", name, iso4217)
return
@@ -126,7 +126,7 @@ def wdq_query(query):
url = url_wmflabs_template + query
htmlresponse = get(url)
jsonresponse = json.loads(htmlresponse.content)
- qlist = map(add_q, jsonresponse.get('items', {}))
+ qlist = list(map(add_q, jsonresponse.get('items', {})))
error = jsonresponse.get('status', {}).get('error', None)
if error is not None and error != 'OK':
print("error for query '" + query + "' :" + error)
@@ -150,12 +150,12 @@ for q in wmflabs_queries:
wdq_query(q)
# static
-add_currency_name(u"euro", 'EUR')
-add_currency_name(u"euros", 'EUR')
-add_currency_name(u"dollar", 'USD')
-add_currency_name(u"dollars", 'USD')
-add_currency_name(u"peso", 'MXN')
-add_currency_name(u"pesos", 'MXN')
+add_currency_name("euro", 'EUR')
+add_currency_name("euros", 'EUR')
+add_currency_name("dollar", 'USD')
+add_currency_name("dollars", 'USD')
+add_currency_name("peso", 'MXN')
+add_currency_name("pesos", 'MXN')
# write
f = open("currencies.json", "wb")