ตัวอย่างโค้ด Python สำหรับ API Numerology ของ Dakidarts¶
ตัวอย่างเหล่านี้แสดงวิธีการเรียกใช้จุดปลาย Core, Karmic, Cycles, และ Horoscope โดยใช้ภาษา Python และคีย์ API Numerology โดยตรง
การตั้งค่า¶
import requests
BASE_URL = "https://api.numerologyapi.com/api/v1"
HEADERS = {
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
ตัวอย่าง 1: จำนวนบุคลิกภาพ (Attitude Number)¶
endpoint = f"{BASE_URL}/attitude_number"
params = {"birth_day": "14", "birth_month": "3"}
response = requests.get(endpoint, headers=HEADERS, params=params)
print(response.json())
ตัวอย่าง 2: จำนวนความท้าทาย (Challenge Number)¶
endpoint = f"{BASE_URL}/challenge_number/post"
payload = {"birth_year": 1990, "birth_month": 5, "birth_day": 15}
response = requests.post(endpoint, headers=HEADERS, json=payload)
print(response.json())
ตัวอย่าง 3: หนี้กรรม (Karmic Debt)¶
endpoint = f"{BASE_URL}/karmic_debt"
params = {"birth_year": "2023", "birth_month": "6", "birth_day": "28"}
response = requests.get(endpoint, headers=HEADERS, params=params)
print(response.json())
ตัวอย่าง 4: บทเรียนจากกรรม (Karmic Lessons)¶
endpoint = f"{BASE_URL}/karmic_lessons"
params = {"full_name": "John Doe Smith"}
response = requests.get(endpoint, headers=HEADERS, params=params)
print(response.json())
ตัวอย่าง 5: จำนวนเส้นทางชีวิต (Life Path Number)¶
endpoint = f"{BASE_URL}/life_path"
params = {"birth_year": "1990", "birth_month": "5", "birth_day": "12"}
response = requests.get(endpoint, headers=HEADERS, params=params)
print(response.json())
ตัวอย่าง 6: จำนวนบุคลิกภาพ (Personality Number)¶
endpoint = f"{BASE_URL}/personality_number/post"
payload = {"first_name": "John", "middle_name": "Robert", "last_name": "Doe"}
response = requests.post(endpoint, headers=HEADERS, json=payload)
print(response.json())
ตัวอย่าง 7: จำนวนชะตากรรม (Destiny Number)¶
endpoint = f"{BASE_URL}/destiny_number"
params = {"first_name": "John", "middle_name": "Doe", "last_name": "Smith"}
response = requests.get(endpoint, headers=HEADERS, params=params)
print(response.json())
ตัวอย่าง 8: จำนวนความปรารถนาในใจ (Heart Desire Number)¶
endpoint = f"{BASE_URL}/heart_desire"
params = {"first_name": "John", "middle_name": "Robert", "last_name": "Doe"}
response = requests.get(endpoint, headers=HEADERS, params=params)
print(response.json())
ตัวอย่าง 9: ปีส่วนตัว (Personal Year)¶
endpoint = f"{BASE_URL}/personal_year"
params = {"prediction_year": "2023", "birth_month": "12", "birth_day": "3"}
response = requests.get(endpoint, headers=HEADERS, params=params)
print(response.json())
ตัวอย่าง 10: การอ่านจากบรรพบุรุษ (Ancestor Reading)¶
endpoint = f"{BASE_URL}/ancestor-reading"
params = {"family_name": "Etuge"}
response = requests.get(endpoint, headers=HEADERS, params=params)
print(response.json())
ตัวอย่าง 11: ระดับการแสดงออก (Planes Of Expression)¶
endpoint = f"{BASE_URL}/planes-of-expression"
payload = {"fullname": "Jesus Christ"}
response = requests.post(endpoint, headers=HEADERS, json=payload)
print(response.json())
ตัวอย่าง 12: โหรวันนี้ (Today Horoscope)¶
endpoint = f"{BASE_URL}/horoscope/today"
params = {"dob": "2002-02-22"}
response = requests.get(endpoint, headers=HEADERS, params=params)
print(response.json())
ตัวอย่าง 13: โหรประจำอาชีพวันนี้ (Today Career Horoscope)¶
endpoint = f"{BASE_URL}/horoscope/career/today"
payload = {"dob": "1995-08-20"}
response = requests.post(endpoint, headers=HEADERS, json=payload)
print(response.json())
ตัวอย่าง 14: โหรประจำสุขภาพวันนี้ (Today Health Horoscope)¶
endpoint = f"{BASE_URL}/horoscope/health/today"
params = {"dob": "1995-08-20"}
response = requests.get(endpoint, headers=HEADERS, params=params)
print(response.json())
ตัวอย่าง 15: โหรประจำวันของดาวเคราะห์ (Planetary Daily Horoscope)¶
endpoint = f"{BASE_URL}/horoscope/planetary/daily"
params = {"dob": "1990-01-01", "day": "today"}
response = requests.get(endpoint, headers=HEADERS, params=params)
print(response.json())
ตัวอย่าง 16: วงจรแห่งความเป็นจริง (Essence Cycle)¶
endpoint = f"{BASE_URL}/essence-cycle"
params = {"full_name": "Alexander Graham Bell", "dob": "1847-03-03", "start_year": "1847"}
response = requests.get(endpoint, headers=HEADERS, params=params)
print(response.json())
ตัวอย่าง 17: การเคลื่อนที่ของดาวเคราะห์ (Transits)¶
endpoint = f"{BASE_URL}/transits"
payload = {"full_name": "Alexander Graham Bell", "dob": "1847-03-03"}
response = requests.post(endpoint, headers=HEADERS, json=payload)
print(response.json())
!!! หมายเหตุ ทุกจุดปลาย (endpoints) รองรับวิธีการ GET และ POST* (เมื่อเหมาะสม) * ตรวจสอบให้แน่ใจว่าได้แทนที่ "YOUR_API_KEY" ด้วยคีย์ที่ถูกต้อง * ใช้ params สำหรับคำขอ GET และ json สำหรับคำขอ POST