Skip to content

Commit

Permalink
0.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoSa-2000 committed Jul 18, 2023
1 parent e373822 commit 5889065
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
Get random anime gifs by category. Use Python (intended (for now) for Discord).

WIP - updated in time to time. Versions below v0.5.3 aren't expected to work flawlessly or at all. Version below v0.6 will not have the gifs library updated anymore.
For troubleshoots, known errors and categories list, check below.

`pip install animegifs`

Expand All @@ -38,6 +39,21 @@ title = gifs.get_animetitle(gif) #get the title of the gif's anime.
malid = gifs.get_malId(gif) #get the ID of the gif's anime myanimelist page.
```

```py
#v0.6>
from animegifs import animegifs

gifs = animegifs.Animegifs()

user_input = input() #let user send any input and search if that input matches a category.
#if user_input == "nom": #nom as category doesn't exist, but is similar to bite (as example)
# user_input = "bite"
try:
gif = gifs.get_gif(user_input) #return the url of the gif if category exists.
except animegifs.errors.CategoryError:
print("not a valid gif category.")
```

## Category list:

**A**
Expand Down Expand Up @@ -102,10 +118,15 @@ malid = gifs.get_malId(gif) #get the ID of the gif's anime myanimelist page.

You can test out the API (and lib functionality) on my bot's website here: https://enkidu-app.github.io/animegifs

# Submit a GIF

If you also want to contribute to the gifs collection, you can submit a gif at: https://forms.gle/wxWmRuy5VCdDCZWp8

# Troubleshooting and other

The first call (only!) in the session is expected to have a slower reaction time (5-15s) because of the authentication process.
If you encounter an error, please raise an issue on the issue page: https://github.com/MarcoSa-2000/animegifs/issues.
Alternatively, you can join my Discord server to request new categories, functions, provide feedback, or report any errors.
Alternatively, you can join my Discord server (https://discord.com/invite/TKZJ4GJj2z) to request new categories, functions, provide feedback, or report any errors.
I do also have a multi-function Discord bot. Feel free to check out the web dashboard here: https://enkidu-app.github.io.

# Copyright
Expand Down
2 changes: 1 addition & 1 deletion animegifs/animegifs.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def get_animetitle(self, gif) -> str:
try:
title = Anime(int(result)).title
except ValueError as exc:
raise errors.MethodNotUpdated(gif) from exc
raise errors.AnimeNotFound(gif) from exc
return title
else:
continue
12 changes: 12 additions & 0 deletions animegifs/distutils/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ def __init__(self, gif, error="Method not yet available for this gif."):
self.error = error
super().__init__(self.error)

class AnimeNotFound(Exception):
"""
Raised if the anime's id is either invalid or has been removed or relocated.
Check firstly if myanimelist.net is working correctly, if confirmed,
please raise an issue in https://github.com/MarcoSa-2000/animegifs/issues.
"""

def __init__(self, gif, error="Anime's ID is either invalid, removed or MyAnimeList is currently down."):
self.gif = gif
self.error = error
super().__init__(self.error)

class AuthTimeout(Exception):
"""
Authentication request timed out. Probably status error 504 on server side.
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
long_description = "\n" + fh.read()

LONG_DESCRIPTION = long_description
VERSION = '0.7.0'
VERSION = '0.7.1'

setup(
name='animegifs',
Expand All @@ -35,5 +35,5 @@
"Programming Language :: Python :: 3.11",
"License :: OSI Approved :: MIT License",
"Operating System :: Microsoft :: Windows"],
keywords=['anime', 'gif', 'python', 'anime-gif', 'discord'],
keywords=['anime', 'gif', 'python', 'anime-gifs', 'discord'],
)

0 comments on commit 5889065

Please sign in to comment.