From 40ffa3ea65237757d70aa0f112e5544cdad27e94 Mon Sep 17 00:00:00 2001 From: Heru J Date: Wed, 14 Apr 2021 13:55:21 -0400 Subject: [PATCH 1/2] Added support for key in list functions --- cocktaildb/cocktaildb.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cocktaildb/cocktaildb.py b/cocktaildb/cocktaildb.py index 8356314..134600d 100644 --- a/cocktaildb/cocktaildb.py +++ b/cocktaildb/cocktaildb.py @@ -10,10 +10,11 @@ class UnsubscriptableKey(Exception): def __init__(self, message): super(UnsubscriptableKey, self).__init__(message) -async def categories(): +async def categories(key: str = None): # Returns a list of categories - category_url = 'https://www.thecocktaildb.com/api/json/v1/1/list.php?c=list' + key = key or 1 + category_url = f'https://www.thecocktaildb.com/api/json/v1/{key}/list.php?c=list' data_categories = await Reqs.get(category_url) l = [categories['strCategory'] for categories in data_categories['drinks']] @@ -23,6 +24,7 @@ async def categories(): async def glasses(): # Returns a list of glasses + key = key or 1 category_url = 'www.thecocktaildb.com/api/json/v1/1/list.php?g=list' data_glasses = await Reqs.get(category_url) @@ -33,6 +35,7 @@ async def glasses(): async def ingredients(): # Returns a list of ingredients + key = key or 1 ingrs_url = 'https://www.thecocktaildb.com/api/json/v1/1/list.php?i=list' data_ingrs = await Reqs.get(ingrs_url) From 02932eea86fff69e5d1c66cdf1a512e614b1f455 Mon Sep 17 00:00:00 2001 From: Heru J Date: Wed, 14 Apr 2021 14:00:10 -0400 Subject: [PATCH 2/2] New ver --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 3dfe5f1..9e2ada2 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ author='clvrk', author_email="herufromstatefarm@gmail.com", url="https://github.com/clvrk/cocktail-wrapper", - version='1.0.6', + version='1.0.7', packages=['cocktaildb'], python_requires=">= 3.6", include_package_data=True,