HTTP error triggering
This commit is contained in:
parent
02808e2977
commit
f76722f9d8
2 changed files with 7 additions and 1 deletions
1
bot.py
1
bot.py
|
@ -37,6 +37,7 @@ l_extensions = (
|
||||||
'cogs.sondage',
|
'cogs.sondage',
|
||||||
'cogs.utility',
|
'cogs.utility',
|
||||||
'cogs.vocal',
|
'cogs.vocal',
|
||||||
|
'cogs.private',
|
||||||
)
|
)
|
||||||
|
|
||||||
help_attrs = dict(hidden=True, in_help=True, name="DONOTUSE")
|
help_attrs = dict(hidden=True, in_help=True, name="DONOTUSE")
|
||||||
|
|
|
@ -249,7 +249,6 @@ class Utility(commands.Cog):
|
||||||
@commands.command(name='getheaders', pass_context=True)
|
@commands.command(name='getheaders', pass_context=True)
|
||||||
async def _getheaders(self, ctx, *, adresse):
|
async def _getheaders(self, ctx, *, adresse):
|
||||||
"""Recuperer les HEADERS :d"""
|
"""Recuperer les HEADERS :d"""
|
||||||
print("Loaded")
|
|
||||||
if adresse.startswith("http://") != True and adresse.startswith("https://") != True:
|
if adresse.startswith("http://") != True and adresse.startswith("https://") != True:
|
||||||
adresse = "http://" + adresse
|
adresse = "http://" + adresse
|
||||||
if len(adresse) > 200:
|
if len(adresse) > 200:
|
||||||
|
@ -282,6 +281,12 @@ class Utility(commands.Cog):
|
||||||
print('''An error occurred: {} The response code was {}'''.format(e, e.getcode()))
|
print('''An error occurred: {} The response code was {}'''.format(e, e.getcode()))
|
||||||
except urllib.error.URLError as e:
|
except urllib.error.URLError as e:
|
||||||
print("ERROR @ getheaders @ urlerror : {} - adress {}".format(e, adresse))
|
print("ERROR @ getheaders @ urlerror : {} - adress {}".format(e, adresse))
|
||||||
|
if "No address associated" in str(e):
|
||||||
|
await ctx.send("Erreur, aucune adresse n'est associé à ce nom d'hôte.")
|
||||||
|
return
|
||||||
|
if "timed out" in str(e):
|
||||||
|
await ctx.send("Erreur, l'adresse en question dépasse le délais d'attente :(")
|
||||||
|
return
|
||||||
await ctx.send('[CONTACTER ADMIN] URLError: {}'.format(e.reason))
|
await ctx.send('[CONTACTER ADMIN] URLError: {}'.format(e.reason))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("ERROR @ getheaders @ Exception : {} - adress {}".format(e, adresse))
|
print("ERROR @ getheaders @ Exception : {} - adress {}".format(e, adresse))
|
||||||
|
|
Loading…
Reference in a new issue