Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update #29

Merged
merged 25 commits into from
Jun 22, 2024
Merged

Update #29

merged 25 commits into from
Jun 22, 2024

Conversation

zYxDevs
Copy link
Owner

@zYxDevs zYxDevs commented Jun 22, 2024

Summary by Sourcery

This pull request enhances the 'AsyncWibuAPI' and 'WibuAPI' classes by adding support for API key authentication. All API request methods have been updated to include headers with the API key. Additionally, the README.md file has been updated to reflect new paid features and include a Repobeats analytics image.

  • Enhancements:
    • Added an optional 'apikey' parameter to the 'AsyncWibuAPI' and 'WibuAPI' classes to support API key authentication.
    • Updated all API request methods in 'AsyncWibuAPI' and 'WibuAPI' classes to include headers with the API key.
  • Documentation:
    • Updated README.md to include new paid features and a Repobeats analytics image.

Copy link

sourcery-ai bot commented Jun 22, 2024

Reviewer's Guide by Sourcery

This pull request introduces the addition of an 'apikey' parameter to the constructors of both AsyncWibuAPI and WibuAPI classes, along with a 'headers' attribute. All API calls within these classes have been updated to include the 'headers' parameter. Additionally, the 'getwibu' utility function has been modified to accept and use the 'headers' parameter. The README.md file has also been updated to include a new analytics badge and additional paid features.

File-Level Changes

Files Changes
wibuapi/wibuapi_async.py
wibuapi/wibuapi.py
Added 'apikey' parameter to constructors and updated API calls to include 'headers' parameter.
wibuapi/utils.py Modified 'getwibu' function to accept and use 'headers' parameter.

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @zYxDevs - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 7 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟡 Documentation: 6 issues found

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@@ -5,267 +5,268 @@


class AsyncWibuAPI:
def __init__(self):
def __init__(self, apikey: str = ""):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Consider making 'apikey' a required parameter.

Making 'apikey' a required parameter would ensure that the API key is always provided, which might be necessary for the API calls to function correctly.

Suggested change
def __init__(self, apikey: str = ""):
def __init__(self, apikey: str):

self.base_url = "https://wibu-api.eu.org/api"
self.deprecated_url = "https://api.wibu-api.eu.org/api"
self.headers = {"x-wibu-key": apikey}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Check for empty API key.

Consider adding a check to ensure that 'apikey' is not empty. If it is, you might want to raise an exception or log a warning.


# Anime, Donghua, Hentai
async def lendrive(self, link: str):
try:
url = f"{self.base_url}/anime/lendrive?link={link}"
return await getwibu(url, timeout=15)
return await getwibu(url, headers=self.headers, timeout=15)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Consider handling specific exceptions.

Catching a general 'Exception' can make debugging difficult. Consider catching specific exceptions that 'getwibu' might raise.

Suggested change
return await getwibu(url, headers=self.headers, timeout=15)
import aiohttp
try:
url = f"{self.base_url}/anime/lendrive?link={link}"
async with aiohttp.ClientSession() as session:
async with session.get(url, headers=self.headers, timeout=15) as response:
return await response.text()
except aiohttp.ClientError as e:
return f"ERROR: {str(e)}. Report to https://t.me/YBotsSupport"

@@ -5,267 +5,268 @@


class WibuAPI:
def __init__(self):
def __init__(self, apikey: str = ""):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Consider making 'apikey' a required parameter.

Making 'apikey' a required parameter would ensure that the API key is always provided, which might be necessary for the API calls to function correctly.

Suggested change
def __init__(self, apikey: str = ""):
def __init__(self, apikey: str):

self.base_url = "https://wibu-api.eu.org/api"
self.deprecated_url = "https://api.wibu-api.eu.org/api"
self.headers = {"x-wibu-key": apikey}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Check for empty API key.

Consider adding a check to ensure that 'apikey' is not empty. If it is, you might want to raise an exception or log a warning.

- [x] LH Translation ziper
- [x] Shinigami ziper
- [x] Worldmanhwas ziper
- [x] Maid Manga ziper
- [x] Mangayaro ziper
- [x] Cosmicscans ziper
- [x] nHentai ziper
- [x] nHentai, nHentai.to, Hentaifox, AsmHentai, Pururin ziper
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (documentation): Consider changing 'ziper' to 'zipper'.

The term 'ziper' appears multiple times in the document. It should be 'zipper'.

- [x] Sheakomik, Sheamanga ziper
- [x] Komikindo.info ziper
- [x] Mikoroku ziper
- [x] Mangakakalot ziper
- [x] OnlyWaifu ziper
- [x] Manhwatop ziper
- [x] Manhuafast ziper
- [x] Drakescans ziper
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (documentation): Consider changing 'ziper' to 'zipper'.

The term 'ziper' appears multiple times in the document. It should be 'zipper'.

- [x] Sheakomik, Sheamanga ziper
- [x] Komikindo.info ziper
- [x] Mikoroku ziper
- [x] Mangakakalot ziper
- [x] OnlyWaifu ziper
- [x] Manhwatop ziper
- [x] Manhuafast ziper
- [x] Drakescans ziper
- [x] Omegascans ziper
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (documentation): Consider changing 'ziper' to 'zipper'.

The term 'ziper' appears multiple times in the document. It should be 'zipper'.

- [x] Sheakomik, Sheamanga ziper
- [x] Komikindo.info ziper
- [x] Mikoroku ziper
- [x] Mangakakalot ziper
- [x] OnlyWaifu ziper
- [x] Manhwatop ziper
- [x] Manhuafast ziper
- [x] Drakescans ziper
- [x] Omegascans ziper
- [x] Telegra.ph ziper
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (documentation): Consider changing 'ziper' to 'zipper'.

The term 'ziper' appears multiple times in the document. It should be 'zipper'.

@@ -55,6 +60,10 @@
- [x] Javhd
- [x] Search parser
- [x] Download link scraper
- [x] Rule34 downloader
- [x] Bunkrr.su downloader
- [x] NudeCosplayGirl ziper
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (documentation): Consider changing 'ziper' to 'zipper'.

The term 'ziper' appears multiple times in the document. It should be 'zipper'.

@zYxDevs zYxDevs merged commit b99942b into main Jun 22, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant