Arti Nama API for Python.
Clean example request for the name meaning feature endpoint. Replace YOUR API and the name input, then run the code.
Checking
Clean example request for the name meaning feature endpoint. Replace YOUR API and the name input, then run the code.
import requests
import urllib.parse
API_KEY = "YOUR API"
NAMA = "YOUR NAME"
ENDPOINT = "https://senpai-bot.store/artinama"
def main():
encoded_name = urllib.parse.quote(NAMA, safe="")
full_url = f"{ENDPOINT}?apikey={API_KEY}&url={encoded_name}"
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
hasil = data.get("result", {}).get("hasil")
if hasil:
print("Arti Nama:")
print(hasil)
else:
print("Tidak ada hasil ditemukan.")
if __name__ == "__main__":
main()