Skip to main content

Apiservisim Python SDK

Apiservisim'in Türkçe API'lerine Python ile erişmek için küçük, bağımlılıksız istemci.

pip install apiservisim komutu paket PyPI'da yayımlandıktan sonra kullanılabilir. Şu anki kaynak koduyla kurmak için aşağıdaki yerel kurulumu kullanın.

Kurulum

python -m pip install .

Bu komutu python-sdk klasöründe çalıştırın. Python 3.10 veya üzeri gerekir.

Kullanım

from apiservisim import ApiServisim

api = ApiServisim()

# Genel bir endpoint: kısa yol veya /api/... biçimi kullanılabilir.
doviz = api.get("doviz")
haberler = api.get("/api/haberler", params={"adet": 5})

print(doviz)
print(haberler)

JSON yanıtları Python nesnesi olarak döner. Görsel veya video gibi JSON olmayan yanıtlar bytes olarak döner. GET ve POST dışında bir HTTP metodu gerekirse request kullanılabilir:

sonuc = api.request("DELETE", "/api/ornek", params={"id": 123})

T.C. Kimlik No Kontrol API'si

import os
from apiservisim import ApiServisim

sonuc = ApiServisim().tckimlik(
    tc=os.environ["TC_KIMLIK_NO"],
    ad=os.environ["KISI_ADI"],
    soyad=os.environ["KISI_SOYADI"],
    dogum_yili=1990,
)
print(sonuc)

Bu endpoint yalnızca yerel biçim ve kontrol basamağı algoritmasını çalıştırır. NVI/MERNİS bağlantısı yoktur ve gerçek bir kişinin kimliğini doğrulamaz. Gerçek kişisel verileri GET URL'sine koymayın veya günlüklerde saklamayın; örnekteki tckimlik metodu POST JSON kullanır.

Özel sunucu adresi, zaman aşımı ve hatalar

from apiservisim import ApiServisim, ApiServisimHTTPError

api = ApiServisim(
    base_url="https://apiservisim.vercel.app",
    timeout=20,
)

try:
    sonuc = api.get("saat", params={"sehir": "İstanbul"})
except ApiServisimHTTPError as hata:
    print(hata.status_code, hata.body)

ApiServisimConnectionError, bağlantı ve zaman aşımı sorunlarında; ApiServisimHTTPError ise API'nin 4xx/5xx yanıtlarında yükseltilir. Yanıt gövdesi JSON değilse ApiServisimHTTPError.body metin olarak kullanılabilir.

SOAP uyumluluk endpoint'ine ham gövde göndermek için:

xml = "<soap:Envelope>...</soap:Envelope>"
yanit = api.post(
    "/Service/KPSPublic.asmx",
    data=xml,
    headers={"Content-Type": "text/xml"},
)

Geliştirme ve test

python -m unittest discover -s tests -v
python -m pip install .

SDK yalnızca Python standart kütüphanesini kullanır; requests veya httpx kurulumu gerekmez.

Metadata

Release files for apiservisim 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for apiservisim 0.1.0
File Size Uploaded Provenance
apiservisim-0.1.0.tar.gz 5.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for apiservisim 0.1.0
File Interpreter ABI Platform
apiservisim-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.3 kB

Release files / apiservisim-0.1.0.tar.gz

Download URL apiservisim-0.1.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d2b07efe294645a72cc3a418449a26ed77a23c5c118a5d467d3f18a149ff5240
BLAKE2b-256 checksum
How to use checksums
87aa2de445444e61bc524513479c4cbd099d800a6789b5b64a35e4e1100f4371
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / apiservisim-0.1.0-py3-none-any.whl

Download URL apiservisim-0.1.0-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a44f610e34248e86d48c4bf633828cd61e47cf7b294837c28791f4a3da241818
BLAKE2b-256 checksum
How to use checksums
232f963c81488e45bf7b1f4708262118477487bd0a5b09d421d35f33457d97aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for apiservisim 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page