Skip to content

Commit

Permalink
Update wibuapi.py
Browse files Browse the repository at this point in the history
  • Loading branch information
zYxDevs authored Oct 23, 2023
1 parent 1841380 commit 60955b2
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions wibuapi/wibuapi.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
# (c) 2022-2023 Yoga Pranata a.k.a zYxDevs
# This file contains all api path from wibuapi.

import asyncio
from .wibuapi_async import AsyncWibuAPI

from requests import get

class WibuAPI:
def __init__(self):
self.loop = asyncio.get_event_loop()
self.async_wibuapi = AsyncWibuAPI()
def __init__(self, apikey=None):
self.base_url = "https://wibu-api.eu.org"
self.deprecated_url = "https://api.wibu-api.eu.org"
self.headers = {"x-wibu-key": apikey}

# Anime, Donghua, Hentai
def lendrive(self, link: str):
try:
return self.loop.run_until_complete(self.async_wibuapi.lendrive(link))
url = f"{self.base_url}/anime/lendrive?link={link}"
return get(url, headers=self.headers, timeout=15).json()
except Exception as e:
return f"ERROR: {str(e)}. Report to https://t.me/YBotsSupport"

def donghua(self, link: str):
try:
return self.loop.run_until_complete(self.async_wibuapi.donghua(link))
url = f"{self.base_url}/anime/donghua?link={link}"
return get(url, timeout=15).json()
except Exception as e:
return f"ERROR: {str(e)}. Report to https://t.me/YBotsSupport"

Expand Down

0 comments on commit 60955b2

Please sign in to comment.