Skip to main content

A python wrapper for YOKATLAS API

Project description

YOKATLAS-py

A modern, type-safe Python wrapper for YOKATLAS API with pydantic validation.

Python 3.9+ Type Hints Pydantic

Installation | Kurulum

Requirements | Gereksinimler: Python 3.9+

You can install the package using pip:

Paketi pip kullanarak yükleyebilirsiniz:

pip install yokatlas-py

Or with uv (recommended):

Ya da uv ile (önerilen):

uv add yokatlas-py

Features | Özellikler

Type Safe: Full type hints and pydantic validation
Modern Python: Requires Python 3.9+ with modern syntax
Fast HTTP: Uses httpx for both sync and async operations
Validation: Runtime validation of all API responses
IDE Support: Enhanced autocomplete and error detection

How to | Kullanım

Quick Start with Type Safety | Tip Güvenli Hızlı Başlangıç

from yokatlas_py import YOKATLASLisansTercihSihirbazi
from yokatlas_py.models import SearchParams, ProgramInfo

# Type-safe parameter validation
params = SearchParams(
    puan_turu="say",
    length=10,
    sehir="İstanbul",
    universite_turu="Devlet"
)

# Perform search with validated parameters
search = YOKATLASLisansTercihSihirbazi(params.model_dump(exclude_none=True))
results = search.search()

# Process results with validation
for result in results[:3]:
    try:
        program = ProgramInfo(**result)
        print(f"🎓 {program.uni_adi}")
        print(f"📚 {program.program_adi}")
        print(f"🏛️ {program.fakulte}")
        print(f"📍 {program.sehir_adi}")
        print("---")
    except ValidationError as e:
        print(f"⚠️ Invalid data: {e}")

Traditional Usage | Geleneksel Kullanım

from yokatlas_py import (
    YOKATLASLisansAtlasi,
    YOKATLASLisansTercihSihirbazi,
    YOKATLASOnlisansAtlasi,
    YOKATLASOnlisansTercihSihirbazi
)

# Atlas classes use async methods
async def example_atlas_usage():
    # Lisans (Bachelor's) program details
    lisans_atlasi = YOKATLASLisansAtlasi({'program_id': '104111719', 'year': 2024})
    lisans_result = await lisans_atlasi.fetch_all_details()
    print("YOKATLAS Lisans Atlas Result:", lisans_result)
    
    # Önlisans (Associate) program details  
    onlisans_atlasi = YOKATLASOnlisansAtlasi({'program_id': '203550463', 'year': 2024})
    onlisans_result = await onlisans_atlasi.fetch_all_details()
    print("YOKATLAS Önlisans Atlas Result:", onlisans_result)

# Search classes use sync methods
def example_search_usage():
    # Search for bachelor's programs
    lisans_params = {
        'puan_turu': 'say',          # Score type: say, ea, söz, dil
        'sehir': 'ANKARA',           # Filter by city
        'universite_turu': 'Devlet', # State universities only
        'length': 5                  # Results per page
    }
    lisans_search = YOKATLASLisansTercihSihirbazi(lisans_params)
    lisans_results = lisans_search.search()
    print("Lisans Search Results:", lisans_results)
    
    # Search for associate programs
    onlisans_params = {
        'puan_turu': 'tyt',         # Score type for associate degrees
        'sehir': 'İSTANBUL',        # City filter
        'universite_turu': 'Devlet', # State universities
        'length': 10                # Results per page
    }
    onlisans_search = YOKATLASOnlisansTercihSihirbazi(onlisans_params)
    onlisans_results = onlisans_search.search()
    print("Önlisans Search Results:", onlisans_results)

# Run examples
example_search_usage()

# For async atlas usage, use asyncio in your environment:
# import asyncio
# asyncio.run(example_atlas_usage())

Pydantic Models | Pydantic Modelleri

The library includes comprehensive pydantic models for type safety and validation:

Kütüphane tip güvenliği ve doğrulama için kapsamlı pydantic modelleri içerir:

Available Models | Mevcut Modeller

  • SearchParams: Search parameter validation
  • ProgramInfo: University program information
  • YearlyData: Year-based statistical data
  • ErrorResponse: Error handling and reporting

Example with Validation | Doğrulama ile Örnek

from yokatlas_py.models import SearchParams, ProgramInfo
from pydantic import ValidationError

# Invalid search parameters will be caught
try:
    params = SearchParams(
        puan_turu="invalid_type",  # Invalid score type
        length=-5  # Invalid length
    )
except ValidationError as e:
    print(f"Validation error: {e}")

# Valid parameters pass validation
params = SearchParams(
    puan_turu="say",
    sehir="İstanbul", 
    length=10
)

Migration from v0.3.x | v0.3.x'den Geçiş

Breaking Changes | Değişiklikler

  • Python 3.9+ Required: Updated from 3.8+ to 3.9+
  • New Dependencies: Added pydantic and typing-extensions
  • Type Hints: All functions now have type annotations

Migration Steps | Geçiş Adımları

  1. Update Python version to 3.9+

    # Check your Python version
    python --version
    
  2. Update the package

    pip install --upgrade yokatlas-py
    
  3. Optional: Use new type-safe features

    # Old way (still works)
    params = {"puan_turu": "say", "length": 10}
    
    # New way (with validation)
    from yokatlas_py.models import SearchParams
    params = SearchParams(puan_turu="say", length=10)
    

License | Lisans

This project is licensed under the MIT License - see the LICENSE file for details.

Bu proje MIT Lisansı ile lisanslanmıştır - detaylar için LICENSE dosyasına bakınız.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yokatlas_py-0.4.1.tar.gz (33.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yokatlas_py-0.4.1-py3-none-any.whl (93.2 kB view details)

Uploaded Python 3

File details

Details for the file yokatlas_py-0.4.1.tar.gz.

File metadata

  • Download URL: yokatlas_py-0.4.1.tar.gz
  • Upload date:
  • Size: 33.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for yokatlas_py-0.4.1.tar.gz
Algorithm Hash digest
SHA256 a99a67f7069ba51620855a833ee049ae094266c6ed72c98158ad1173bf68a15e
MD5 ce82e8c312505f2720d0c1d59e79c3db
BLAKE2b-256 d844b55bbe8f881265f893fd31cf3ce403392f8df6725f38c742f8ce29d4a918

See more details on using hashes here.

Provenance

The following attestation bundles were made for yokatlas_py-0.4.1.tar.gz:

Publisher: python-publish.yml on saidsurucu/yokatlas-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file yokatlas_py-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: yokatlas_py-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 93.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for yokatlas_py-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c55e4bb3856172fa49432eb7437d6a29618787ccb2baecdad0772446daa130e9
MD5 43e314683386c3ef7ef80a6ba1653d5b
BLAKE2b-256 a6679cf85c028853e4336caaf78e72a24fbf0bd2a7d694d677573f0dce3252e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for yokatlas_py-0.4.1-py3-none-any.whl:

Publisher: python-publish.yml on saidsurucu/yokatlas-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page