Zodiac API for Python.
Clean example request for the zodiac feature endpoint. Replace YOUR API and the zodiac input, then run the code.
Checking
Clean example request for the zodiac feature endpoint. Replace YOUR API and the zodiac input, then run the code.
import requests
import urllib.parse
API_KEY = "YOUR API"
ZODIAK = "YOUR ZODIAC"
ENDPOINT = "https://senpai-bot.store/zodiac"
def main():
encoded_zodiak = urllib.parse.quote(ZODIAK, safe="")
full_url = f"{ENDPOINT}?apikey={API_KEY}&url={encoded_zodiak}"
try:
response = requests.get(full_url)
response.raise_for_status()
except requests.RequestException as e:
print(f"Gagal request: {e}")
return
try:
data = response.json()
except ValueError:
print("Gagal parsing JSON.")
return
if data.get("code") != 200:
print(f"API error code: {data.get('code')} - {data.get('message', 'Tidak diketahui')}")
return
result = data.get("result", {})
if result:
print("Arti Zodiak:")
print(f"Zodiak : {result.get('zodiak')}")
print(f"Deskripsi : {result.get('hasil')}")
else:
print("Tidak ada hasil ditemukan.")
if __name__ == "__main__":
main()