mirror of
https://gitlab.wikimedia.org/ladsgroup/Phabricator-maintenance-bot
synced 2024-12-22 18:40:53 +01:00
new_wikis_handler: Make get_file_from_gerrit support 404s
Previously, the function threw fatal on a 404.
This commit is contained in:
parent
82b90d32a9
commit
eda3c0632a
1 changed files with 5 additions and 1 deletions
|
@ -20,7 +20,11 @@ def add_text(a):
|
|||
def get_file_from_gerrit(path):
|
||||
gerrit_url = 'https://gerrit.wikimedia.org/g/'
|
||||
url = gerrit_url + '{0}?format=TEXT'.format(path)
|
||||
return base64.b64decode(requests.get(url).text).decode('utf-8')
|
||||
r = requests.get(url)
|
||||
if r.status_code == 200:
|
||||
return base64.b64decode(r.text).decode('utf-8')
|
||||
else:
|
||||
return ''
|
||||
|
||||
|
||||
def hostname_resolves(hostname):
|
||||
|
|
Loading…
Reference in a new issue