Don't use urllib.parse.urljoin to concatenate URLs
It doesn't support more than two arguments, and it's not really needed with the predictable URLs we have anyways. See #2891.
This commit is contained in:
parent
1d7af2e74b
commit
6c300f41dd
@ -29,7 +29,6 @@ import json
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
import urllib.parse
|
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
@ -91,7 +90,7 @@ def valid_languages():
|
|||||||
|
|
||||||
def language_list_from_api():
|
def language_list_from_api():
|
||||||
"""Return a JSON with a list of available languages from Google API."""
|
"""Return a JSON with a list of available languages from Google API."""
|
||||||
listurl = urllib.parse.urljoin(API_URL, '?format=JSON')
|
listurl = API_URL + '?format=JSON'
|
||||||
response = urllib.request.urlopen(listurl)
|
response = urllib.request.urlopen(listurl)
|
||||||
# A special 5-byte prefix must be stripped from the response content
|
# A special 5-byte prefix must be stripped from the response content
|
||||||
# See: https://github.com/google/gitiles/issues/22
|
# See: https://github.com/google/gitiles/issues/22
|
||||||
@ -147,7 +146,7 @@ def filter_languages(languages, selected):
|
|||||||
def install_lang(lang):
|
def install_lang(lang):
|
||||||
"""Install a single lang given by the argument."""
|
"""Install a single lang given by the argument."""
|
||||||
print('Installing {}: {}'.format(lang.code, lang.name))
|
print('Installing {}: {}'.format(lang.code, lang.name))
|
||||||
lang_url = urllib.parse.urljoin(API_URL, lang.file_path, '?format=TEXT')
|
lang_url = API_URL + lang.file_path + '?format=TEXT'
|
||||||
if not os.path.isdir(spell.dictionary_dir()):
|
if not os.path.isdir(spell.dictionary_dir()):
|
||||||
warn_msg = '{} does not exist, creating the directory'
|
warn_msg = '{} does not exist, creating the directory'
|
||||||
print(warn_msg.format(spell.dictionary_dir()))
|
print(warn_msg.format(spell.dictionary_dir()))
|
||||||
|
Loading…
Reference in New Issue
Block a user