From e1aeec67f1696734ba8a8fcdd7d6d8e531a86a66 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Jun 2021 01:07:37 +0000 Subject: [PATCH 01/15] :arrow_up: Bump urllib3 from 1.26.3 to 1.26.5 Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.3 to 1.26.5. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/1.26.3...1.26.5) --- updated-dependencies: - dependency-name: urllib3 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 1c3e71c..2b39b04 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ url="""https://github.com/thenamesweretakenalready/Sv443s-JokeAPI-Python-Wrapper""", download_url=f"https://github.com/thenamesweretakenalready/Sv443s-JokeAPI-Python-Wrapper/archive/v{version}.tar.gz", keywords=["api wrapper", "wrapper", "api", "jokes", "python", "joke api"], - install_requires=["urllib3==1.25.8", "simplejson==3.17.0", "python-dotenv==0.13.0"], + install_requires=["urllib3==1.26.5", "simplejson==3.17.0", "python-dotenv==0.13.0"], classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", From cecb6572d95bf68c49e3ad943b81b9e8fa023770 Mon Sep 17 00:00:00 2001 From: leet_hakker <43702423+leet-hakker@users.noreply.github.com> Date: Thu, 5 Aug 2021 14:55:58 +0100 Subject: [PATCH 02/15] Delete requirements.txt --- requirements.txt | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 7a37ac4..0000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -urllib3==1.25.8 -simplejson==3.17.0 -python-dotenv==0.13.0 From fdf76f29cf792a86141ea20eef0a1574f8a8e987 Mon Sep 17 00:00:00 2001 From: thenamesweretakenalready Date: Thu, 5 Aug 2021 20:46:25 +0100 Subject: [PATCH 03/15] Update pyproject.toml --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index df3da86..8d5451b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,6 @@ black = "^21.6b0" pytest = "^6.2.4" pytest-asyncio = "^0.15.1" - [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" From 1383ebf48621408c64fe82e38b966312fcfdc22f Mon Sep 17 00:00:00 2001 From: thenamesweretakenalready Date: Thu, 5 Aug 2021 20:47:21 +0100 Subject: [PATCH 04/15] :fire: Remove setup.py --- setup.py | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 setup.py diff --git a/setup.py b/setup.py deleted file mode 100644 index 2b39b04..0000000 --- a/setup.py +++ /dev/null @@ -1,29 +0,0 @@ -import setuptools - -with open("README.md", "r") as fh: - long_description = fh.read() - -version = "0.2.8" - -setuptools.setup( - name="jokeapi", - packages=["jokeapi"], - version=version, - license="GNU General Public License v3 (GPLv3)", - description="An API Wrapper for Sv443's JokeAPI", - long_description=long_description, - long_description_content_type="text/markdown", - author="thenamesweretakenalready", - author_email="leet_haker@cyber-wizard.com", - url="""https://github.com/thenamesweretakenalready/Sv443s-JokeAPI-Python-Wrapper""", - download_url=f"https://github.com/thenamesweretakenalready/Sv443s-JokeAPI-Python-Wrapper/archive/v{version}.tar.gz", - keywords=["api wrapper", "wrapper", "api", "jokes", "python", "joke api"], - install_requires=["urllib3==1.26.5", "simplejson==3.17.0", "python-dotenv==0.13.0"], - classifiers=[ - "Development Status :: 3 - Alpha", - "Intended Audience :: Developers", - "Topic :: Software Development :: Build Tools", - "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", - "Programming Language :: Python :: 3.8", - ], -) From 52683e1f2ba4a65d9e6862b19c84ce7fa6ac3221 Mon Sep 17 00:00:00 2001 From: leet_hakker <43702423+leet-hakker@users.noreply.github.com> Date: Fri, 6 Aug 2021 13:45:48 +0100 Subject: [PATCH 05/15] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f0e76bf..e8678f3 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Downloads](https://pepy.tech/badge/jokeapi)](https://pepy.tech/project/jokeapi) [![Downloads](https://pepy.tech/badge/jokeapi/month)](https://pepy.tech/project/jokeapi/month) [![Downloads](https://pepy.tech/badge/jokeapi/week)](https://pepy.tech/project/jokeapi/week) -[![CircleCI](https://circleci.com/gh/thenamesweretakenalready/Sv443s-JokeAPI-Python-Wrapper.svg?style=svg)](https://circleci.com/gh/thenamesweretakenalready/Sv443s-JokeAPI-Python-Wrapper) +[![CircleCI](https://circleci.com/gh/leet-hakkker/JokeAPI-Python.svg?style=svg)](https://circleci.com/gh/leet-hakker/JokeAPI-Python) From 5d32c2a1bb8a6d8945151722cf88c25d6defeda4 Mon Sep 17 00:00:00 2001 From: leet_hakker <43702423+leet-hakker@users.noreply.github.com> Date: Fri, 6 Aug 2021 13:46:55 +0100 Subject: [PATCH 06/15] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e8678f3..784c138 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Downloads](https://pepy.tech/badge/jokeapi)](https://pepy.tech/project/jokeapi) [![Downloads](https://pepy.tech/badge/jokeapi/month)](https://pepy.tech/project/jokeapi/month) [![Downloads](https://pepy.tech/badge/jokeapi/week)](https://pepy.tech/project/jokeapi/week) -[![CircleCI](https://circleci.com/gh/leet-hakkker/JokeAPI-Python.svg?style=svg)](https://circleci.com/gh/leet-hakker/JokeAPI-Python) +[![CircleCI](https://circleci.com/gh/leet-hakker/JokeAPI-Python.svg?style=svg)](https://circleci.com/gh/leet-hakker/JokeAPI-Python) From b11ab6db550755066824822aa2642258253cc08d Mon Sep 17 00:00:00 2001 From: thenamesweretakenalready <43702423+thenamesweretakenalready@users.noreply.github.com> Date: Fri, 6 Aug 2021 15:25:54 +0100 Subject: [PATCH 07/15] :fire: Remove debugging code --- pyproject.toml | 2 +- src/jokeapi/main.py | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8d5451b..eb6356d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "jokeapi" -version = "1.0.0" +version = "1.0.1" description = "Python API Wrapper for Sv443's JokeAPI (https://v2.jokeapi.dev)" authors = ["thenamesweretakenalready <43702423+thenamesweretakenalready@users.noreply.github.com>"] license = "GPL v3.0" diff --git a/src/jokeapi/main.py b/src/jokeapi/main.py index f972651..67072ca 100644 --- a/src/jokeapi/main.py +++ b/src/jokeapi/main.py @@ -230,8 +230,6 @@ async def send_request( returns.append(headers) if auth_token: - print(len(headers.split("token-valid"))) - print(len(headers.split("Token-Valid"))) if "token-valid" in headers: returns.append( {"Token-Valid": bool(int(headers.split("token-valid")[1][4]))} From ea2fedb18aa143f8cd149e712584933ae5cfa28d Mon Sep 17 00:00:00 2001 From: thenamesweretakenalready <43702423+thenamesweretakenalready@users.noreply.github.com> Date: Fri, 6 Aug 2021 16:24:55 +0100 Subject: [PATCH 08/15] :memo: Update pyproject.toml --- pyproject.toml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index eb6356d..341bef7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,13 @@ [tool.poetry] name = "jokeapi" -version = "1.0.1" +version = "1.0.2" description = "Python API Wrapper for Sv443's JokeAPI (https://v2.jokeapi.dev)" -authors = ["thenamesweretakenalready <43702423+thenamesweretakenalready@users.noreply.github.com>"] -license = "GPL v3.0" +readme = "README.md" +homepage = "https://pypi.org/project/jokeapi" +repository = "https://github.com/leet-hakker/JokeAPI-Python" +authors = ["leet-hakker "] +maintainers = ["leet-hakker"] +license = "GPL-3.0-only" [tool.poetry.dependencies] python = "^3.9" From 43e2851c0e522d6781a4eb4488e8ad037d95b023 Mon Sep 17 00:00:00 2001 From: thenamesweretakenalready <43702423+thenamesweretakenalready@users.noreply.github.com> Date: Fri, 6 Aug 2021 16:30:38 +0100 Subject: [PATCH 09/15] :memo: Update documentation --- README.md | 68 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 784c138..6407e32 100644 --- a/README.md +++ b/README.md @@ -42,15 +42,19 @@ Note that joke submissions are manually checked and you will be ratelimited. ### Example ```python - from jokeapi import Jokes # Import the Jokes class - - j = Jokes() # Initialise the class - joke = j.get_joke()[0] # Retrieve a random joke - if joke["type"] == "single": # Print the joke - print(joke["joke"]) - else: - print(joke["setup"]) - print(joke["delivery"]) +from jokeapi import Jokes # Import the Jokes class +import asyncio + +async def print_joke(): + j = await Jokes() # Initialise the class + await j.get_joke() # Retrieve a random joke + if joke["type"] == "single": # Print the joke + print(joke["joke"]) + else: + print(joke["setup"]) + print(joke["delivery"]) + +asyncio.run(print_joke()) ``` ### Parameters @@ -71,7 +75,7 @@ If left blank it will default to use `Any`. ##### Example ```python - joke = j.get_joke(category=['programming', 'dark']) # Will return a joke that fits in either the programming or dark category. + joke = await j.get_joke(category=['programming', 'dark']) # Will return a joke that fits in either the programming or dark category. ``` --- @@ -91,7 +95,7 @@ If left blank it will default to `None`. ##### Example ```python - joke = j.get_joke(blacklist=['nsfw', 'racist']) # Will return a joke that does not have either the flag "nsfw" or "racist". + joke = await j.get_joke(blacklist=['nsfw', 'racist']) # Will return a joke that does not have either the flag "nsfw" or "racist". ``` --- @@ -110,7 +114,7 @@ If left blank it will default to `json`. ##### Example ```python - joke = j.get_joke(response_format="xml") # Will return a joke in xml format. + joke = await j.get_joke(response_format="xml") # Will return a joke in xml format. ``` --- @@ -128,7 +132,7 @@ If left blank it will default to `Any` ##### Example ```python - joke = j.get_joke(joke_type="twopart") # Will return a twopart joke; both a setup and a delivery. + joke = await j.get_joke(joke_type="twopart") # Will return a twopart joke; both a setup and a delivery. ``` --- @@ -142,7 +146,7 @@ If left blank it will default to `None` ##### Example ```python - joke = j.get_joke(search_string="the") # Will return a joke with the word "the" in it. + joke = await j.get_joke(search_string="the") # Will return a joke with the word "the" in it. # If there are no jokes then it will return the error from the API. ``` @@ -160,7 +164,7 @@ If left blank it will default to the maximum range. ##### Example ```python - joke = j.get_joke(id_range=[10,100]) # Will return a joke with the ID between 10 and 100. + joke = await j.get_joke(id_range=[10,100]) # Will return a joke with the ID between 10 and 100. ``` --- @@ -174,7 +178,7 @@ api defaults to 1 if you use a number larger than the maximum. Defaults to 1. ##### Example ```python - joke = j.get_joke(amount=2) # Will return 2 jokes. + joke = await j.get_joke(amount=2) # Will return 2 jokes. ``` --- @@ -187,7 +191,7 @@ documentation. Defaults to en. ##### Example ```python - joke = j.get_joke(lang="de") + joke = await j.get_joke(lang="de") ``` --- @@ -201,7 +205,7 @@ more requests than normal users. Defaults to None ##### Example ```python - joke = j.get_joke(auth_token="aaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbb") # Will send the token to the api in a header. + joke = await j.get_joke(auth_token="aaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbb") # Will send the token to the api in a header. ``` --- @@ -216,7 +220,7 @@ to change it ##### Example ```python - joke = j.get_joke(user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0") + joke = await j.get_joke(user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0") # This is in fact the default user agent, and tells the API that we are visitng the page from a Firefox 77.0 # browser using Windows 10 64bit. ``` @@ -233,7 +237,7 @@ Defaults to False. ##### Example ```python - response = j.get_joke(return_headers=True) + response = await j.get_joke(return_headers=True) joke = response[0] headers = response[1] @@ -340,16 +344,20 @@ If not, feel free to ask me through one of the channels provided below. ```python from jokeapi import Jokes +import asyncio -j = Jokes() +async def submit_new_joke(): + j = await Jokes() -j.submit_joke("Miscellaneous", "funny haha", { - "nsfw": False, - "religious": False, - "political": False, - "racist": False, - "sexist": False -}, lang="de") + await j.submit_joke("Miscellaneous", "funny haha", { + "nsfw": False, + "religious": False, + "political": False, + "racist": False, + "sexist": False + }, lang="de") + +asyncio.run(submit_new_joke()) ``` --- @@ -417,8 +425,6 @@ Defaults to `en` ![Discord](https://discord.com/assets/07dca80a102d4149e9736d4b162cff6f.ico)[**Discord**](https://discord.gg/mB989eP) -[Issue Tracker](https://github.com/thenamesweretakenalready/Sv443s-JokeAPI-Python-Wrapper/issues) +[Issue Tracker](https://github.com/thenamesweretakenalready/JokeAPI-Python/issues) [e-mail](mailto:leet_haker@cyber-wizard.com) - -[Twitter](https://twitter.com/HakkerLeet) From b956f948a00056251a19703ccb1797c951f19635 Mon Sep 17 00:00:00 2001 From: thenamesweretakenalready <43702423+thenamesweretakenalready@users.noreply.github.com> Date: Sun, 20 Feb 2022 22:55:14 +0000 Subject: [PATCH 10/15] :bug: Fix typo in main.py --- pyproject.toml | 2 +- src/jokeapi/main.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 341bef7..cc7831d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "jokeapi" -version = "1.0.2" +version = "1.0.3" description = "Python API Wrapper for Sv443's JokeAPI (https://v2.jokeapi.dev)" readme = "README.md" homepage = "https://pypi.org/project/jokeapi" diff --git a/src/jokeapi/main.py b/src/jokeapi/main.py index 67072ca..7fc2031 100644 --- a/src/jokeapi/main.py +++ b/src/jokeapi/main.py @@ -157,7 +157,7 @@ async def build_request( if search_string: r += f"&contains={search_string}" if id_range: - r += f"i&dRange={id_range[0]}-{id_range[1]}" + r += f"&idRange={id_range[0]}-{id_range[1]}" if amount > 10: raise ValueError( f"amount parameter must be no greater than 10. you passed {amount}." From f7bd52b71a2ee752dd54aed4b71a3974baadac33 Mon Sep 17 00:00:00 2001 From: leet hakker Date: Tue, 22 Mar 2022 09:33:00 +0000 Subject: [PATCH 11/15] :memo: Fix incorrect code in documentation. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6407e32..d40f682 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ import asyncio async def print_joke(): j = await Jokes() # Initialise the class - await j.get_joke() # Retrieve a random joke + joke = await j.get_joke() # Retrieve a random joke if joke["type"] == "single": # Print the joke print(joke["joke"]) else: From 793344070eeff6abbb2287fefb437d121eff8914 Mon Sep 17 00:00:00 2001 From: leet_hakker Date: Wed, 13 Apr 2022 12:52:36 +0100 Subject: [PATCH 12/15] Downgrade Python to >=3.7 --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index cc7831d..650944d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "jokeapi" -version = "1.0.3" +version = "1.0.4" description = "Python API Wrapper for Sv443's JokeAPI (https://v2.jokeapi.dev)" readme = "README.md" homepage = "https://pypi.org/project/jokeapi" @@ -10,7 +10,7 @@ maintainers = ["leet-hakker"] license = "GPL-3.0-only" [tool.poetry.dependencies] -python = "^3.9" +python = "^3.7" urllib3 = "^1.26.2" aiohttp = "^3.7.4" simplejson = "^3.17.2" From 88ee51b4c52131fc3ce4257e19363d62705f54c9 Mon Sep 17 00:00:00 2001 From: Sven Fehler <38158426+Sv443@users.noreply.github.com> Date: Thu, 30 Jun 2022 13:57:46 +0200 Subject: [PATCH 13/15] Remove print() --- src/jokeapi/__init__.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/jokeapi/__init__.py b/src/jokeapi/__init__.py index 89c9276..06dc843 100644 --- a/src/jokeapi/__init__.py +++ b/src/jokeapi/__init__.py @@ -1,3 +1 @@ from jokeapi.main import Jokes - -print("Sv443's JokeAPI") From 9b782dfd9e00ace97578e7890532e2925a15c062 Mon Sep 17 00:00:00 2001 From: leet_hakker Date: Fri, 1 Jul 2022 07:44:25 +0100 Subject: [PATCH 14/15] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 650944d..872d72b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "jokeapi" -version = "1.0.4" +version = "1.0.5" description = "Python API Wrapper for Sv443's JokeAPI (https://v2.jokeapi.dev)" readme = "README.md" homepage = "https://pypi.org/project/jokeapi" From 82b366d3bd6ae0deb8d67771c3baa5dce187f164 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Wed, 8 Jan 2025 23:22:49 +0000 Subject: [PATCH 15/15] Update CI Link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d40f682..52be033 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Downloads](https://pepy.tech/badge/jokeapi)](https://pepy.tech/project/jokeapi) [![Downloads](https://pepy.tech/badge/jokeapi/month)](https://pepy.tech/project/jokeapi/month) [![Downloads](https://pepy.tech/badge/jokeapi/week)](https://pepy.tech/project/jokeapi/week) -[![CircleCI](https://circleci.com/gh/leet-hakker/JokeAPI-Python.svg?style=svg)](https://circleci.com/gh/leet-hakker/JokeAPI-Python) +[![CircleCI](https://circleci.com/gh/leet-hakker/JokeAPI-Python.svg?style=svg)](https://circleci.com/gh/benjhar/JokeAPI-Python)