Merge branch 'master' of ssh://git.73k.us:2222/adam/err-doggo

This commit is contained in:
Adam Piontek 2018-08-26 10:32:23 -04:00
commit 755ddc2f36
3 changed files with 10 additions and 3 deletions

View file

@ -3,6 +3,7 @@
root = true root = true
[*] [*]
end_of_line = lf
insert_final_newline = true insert_final_newline = true
trim_trailing_whitespace = true trim_trailing_whitespace = true
indent_style = space indent_style = space

7
.gitignore vendored
View file

@ -8,7 +8,6 @@ __pycache__/
# Distribution / packaging # Distribution / packaging
.Python .Python
env/
build/ build/
develop-eggs/ develop-eggs/
dist/ dist/
@ -24,6 +23,7 @@ wheels/
*.egg-info/ *.egg-info/
.installed.cfg .installed.cfg
*.egg *.egg
MANIFEST
# PyInstaller # PyInstaller
# Usually these files are written by a python script from a template # Usually these files are written by a python script from a template
@ -45,6 +45,7 @@ nosetests.xml
coverage.xml coverage.xml
*.cover *.cover
.hypothesis/ .hypothesis/
.pytest_cache/
# Translations # Translations
*.mo *.mo
@ -53,6 +54,7 @@ coverage.xml
# Django stuff: # Django stuff:
*.log *.log
local_settings.py local_settings.py
db.sqlite3
# Flask stuff: # Flask stuff:
instance/ instance/
@ -84,8 +86,11 @@ celerybeat-schedule
# virtualenv # virtualenv
.venv .venv
env/
venv/ venv/
ENV/ ENV/
env.bak/
venv.bak/
# Spyder project settings # Spyder project settings
.spyderproject .spyderproject

View file

@ -6,6 +6,7 @@ from errbot import botcmd, BotPlugin
class Doggo(BotPlugin): class Doggo(BotPlugin):
"""Fetch random dog image URLs""" """Fetch random dog image URLs"""
min_err_version = '3.0.0' # Optional, but recommended
BASE_URL = 'https://dog.ceo/api' BASE_URL = 'https://dog.ceo/api'
@ -140,7 +141,7 @@ class Doggo(BotPlugin):
return 'Breed not found: {}. List breeds with !listbreeds'.format(breed) return 'Breed not found: {}. List breeds with !listbreeds'.format(breed)
else: else:
return 'Please tell me the breed for which you want sub-breeds, like: *!reloadsubbreeds terrier*' return 'Please tell me the breed for which you want sub-breeds, like: *!reloadsubbreeds terrier*'
try: try:
resp = requests.get(url) resp = requests.get(url)
resp.raise_for_status() resp.raise_for_status()
@ -151,7 +152,7 @@ class Doggo(BotPlugin):
data = resp.json()['message'] data = resp.json()['message']
if not isinstance(data, list): if not isinstance(data, list):
return 'Unable to load sub-breeds list' return 'Unable to load sub-breeds list'
self.breeds[breed] = data self.breeds[breed] = data
if 'calledbyfunction' not in args: if 'calledbyfunction' not in args:
# Tell user command was successful # Tell user command was successful