Skip to content

Commit

Permalink
✨Added Error Raise✨
Browse files Browse the repository at this point in the history
  • Loading branch information
DARKPOISON-yt committed Jan 12, 2022
1 parent 0b43bbb commit ba80d3c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ fact = data["fact"]

```Python
import animalapi as a
data = a.dog()
data = a.animal_data("dog")
img = data["image"]
fact = data["fact"]
print(img)
print(fact)

```

> Currently this package supports these animals:- ["dog","cat","panda","fox","kangaroo","raccoon","birb","red_panda","koala"]
> Currently this package supports these animals:- ["dog","cat","panda","fox","kangaroo","raccoon","bird","red_panda","koala"]
2 changes: 1 addition & 1 deletion __main__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import animalapi as a

print(a.rand_animals())
print(a.animal_data("dogs"))
2 changes: 2 additions & 0 deletions animalapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@


def animal_data(animalname):
if animalname not in aliases:
raise ValueError("That animal name is not available. Valid animals are: -\"dog","cat","panda","fox","kangaroo","raccoon","bird","red_panda","koala\"")
res = requests.get(base_url + f"animal/{aliases[animalname]}")
if res.status_code != 200:
return "Invalid response from API"
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
with codecs.open(os.path.join(here, "README.md"), encoding="utf-8") as fh:
long_description = "\n" + fh.read()

VERSION = "0.0.2"
VERSION = "0.0.3"
DESCRIPTION = "This is the package for api scapper that provides animal images and their facts."
LONG_DESCRIPTION = ""

Expand All @@ -22,7 +22,7 @@
packages= ["animalapi"],
install_requires=["requests"],
keywords=[],
download_url = "https://github.com/DARKPOISON-yt/animalapi/archive/refs/tags/0.0.1.tar.gz",
download_url = "https://github.com/DARKPOISON-yt/animalapi/archive/refs/tags/0.0.3.tar.gz",
classifiers=[
"Development Status :: 1 - Planning",
"Intended Audience :: Developers",
Expand Down

0 comments on commit ba80d3c

Please sign in to comment.