İBB’nin açık veri API’sini kullanarak bir hattın geçtiği durakları ve tam güzergah bilgisini almak istiyorum. Bazı metotları kullanabilirken, bazıları 500 hatası veriyor.
GetDurak_json
→ Tüm durakları veya belirli bir durağın özelliklerini listeleyebiliyorum.
GeHat_json
→ Tüm hatları veya belirli bir hattın özelliklerini listeleyebiliyorum
Bu iki metot sorunsuz çalışıyor ancak ancak GetHatGuzergah_json
metodunu çalıştıramıyorum
Bu metodun hattın tam güzergah bilgisini döndürmesi gerektiğini düşündüm ve API’ye şu SOAP isteğini gönderdim:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetHatGuzergah_json xmlns="http://tempuri.org/">
<HatKodu>500T</HatKodu>
</GetHatGuzergah_json>
</soap:Body>
</soap:Envelope>
API’ye Python ile şu şekilde istek yapıyorum:
import requests
import xml.etree.ElementTree as ET
import json
url = "https://api.ibb.gov.tr/iett/UlasimAnaVeri/HatDurakGuzergah.asmx"
headers = {
"Content-Type": "text/xml; charset=utf-8",
"SOAPAction": "http://tempuri.org/GetHatGuzergah_json"
}
soap_body = f"""<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetHatGuzergah_json xmlns="http://tempuri.org/">
<HatKodu>500T</HatKodu>
</GetHatGuzergah_json>
</soap:Body>
</soap:Envelope>"""
response = requests.post(url, data=soap_body, headers=headers)
if response.status_code == 200:
print(response.text)
else:
print("Hata kodu:", response.status_code)
Bu isteği gönderdiğimde 500 Internal Server Error
alıyorum.
https://api.ibb.gov.tr/iett/UlasimAnaVeri/HatDurakGuzergah.asmx?wsdl
İbb’nin kulanma kılavuzu tarzı bir pdf dosyası var ama sadece bazı metotları gösteriyor.GitHub - akgembi12/ibbotobus
Sormak istediğim:
GetHatGuzergah_json
metodunu çalıştırabilen var mı?- API’ye gönderdiğim SOAP isteğinde bir hata mı yapıyorum?
- Eğer bu metod çalışmıyorsa, hattın tam güzergah koordinatlarını almak için alternatif bir yol var mı?