mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2024-06-08 08:52:27 +02:00
Change source of country -> continent map.
The previous source at https://datahub.io/JohnSnowLabs/ no longer exists.
This commit is contained in:
parent
0df708a74e
commit
137e1f84ad
|
@ -30,7 +30,7 @@ import json
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
URL = 'https://datahub.io/JohnSnowLabs/country-and-continent-codes-list/r/country-and-continent-codes-list-csv.json'
|
URL = 'https://datahub.io/core/country-codes/r/country-codes.json'
|
||||||
|
|
||||||
def tostr(s):
|
def tostr(s):
|
||||||
if isinstance(s, bytes) and not isinstance(s, str):
|
if isinstance(s, bytes) and not isinstance(s, str):
|
||||||
|
@ -58,8 +58,11 @@ def generate_map(filename):
|
||||||
data = json.loads(tostr(data))
|
data = json.loads(tostr(data))
|
||||||
continents = {}
|
continents = {}
|
||||||
for entry in data:
|
for entry in data:
|
||||||
country = entry['Two_Letter_Country_Code']
|
country = entry['ISO3166-1-Alpha-2']
|
||||||
continent = entry['Continent_Code']
|
continent = entry['Continent']
|
||||||
|
if country is None and continent is None:
|
||||||
|
continue
|
||||||
|
|
||||||
continents.setdefault(country, []).append(continent)
|
continents.setdefault(country, []).append(continent)
|
||||||
|
|
||||||
out = StringIO()
|
out = StringIO()
|
||||||
|
|
Loading…
Reference in a new issue