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
Smart Search: Fuzzy university matching and flexible program name search
Complete Data: All 235 lisans + 176 önlisans universities with 450+ programs

How to | Kullanım

Quick Start with Smart Search | Akıllı Arama ile Hızlı Başlangıç

from yokatlas_py import search_lisans_programs, search_onlisans_programs

# 🎯 Smart fuzzy search - works with partial names and abbreviations
# Akıllı bulanık arama - kısmi isimler ve kısaltmalarla çalışır

# Search for bachelor's programs with fuzzy matching
results = search_lisans_programs({
    "uni_adi": "boğaziçi",      # Finds "BOĞAZİÇİ ÜNİVERSİTESİ"
    "program_adi": "bilgisayar", # Finds all computer-related programs
    "sehir": "istanbul"          # Case-insensitive city matching
})

print(f"📚 Found {len(results)} lisans programs:")
for program in results[:3]:
    print(f"🎓 {program['uni_adi']}")
    print(f"💻 {program['program_adi']}")
    print(f"📍 {program['sehir_adi']}")
    print("---")

# Search for associate programs with abbreviations
onlisans_results = search_onlisans_programs({
    "uni_adi": "anadolu",        # Finds "ANADOLU ÜNİVERSİTESİ"
    "program_adi": "turizm"      # Finds all tourism-related programs
})

print(f"🏫 Found {len(onlisans_results)} önlisans programs:")
for program in onlisans_results[:2]:
    print(f"🎓 {program['uni_adi']}")
    print(f"🏖️ {program['program_adi']}")
    print("---")

Type-Safe Search | Tip Güvenli Arama

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

# 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
)

Smart Search Features | Akıllı Arama Özellikleri

Fuzzy University Matching | Bulanık Üniversite Eşleştirme

The library automatically matches partial and abbreviated university names:

from yokatlas_py import search_lisans_programs

# All of these work and find "BOĞAZİÇİ ÜNİVERSİTESİ"
search_lisans_programs({"uni_adi": "boğaziçi"})
search_lisans_programs({"uni_adi": "bogazici"})  # Without Turkish chars
search_lisans_programs({"uni_adi": "boun"})      # Common abbreviation

# Common university abbreviations supported:
# "odtu"/"metu" → "ORTA DOĞU TEKNİK ÜNİVERSİTESİ"
# "itu" → "İSTANBUL TEKNİK ÜNİVERSİTESİ" 
# "hacettepe" → "HACETTEPE ÜNİVERSİTESİ"

Flexible Program Matching | Esnek Program Eşleştirme

Partial program names automatically find all related programs:

# "bilgisayar" finds all computer-related programs:
# - "Bilgisayar Mühendisliği"
# - "Bilgisayar Bilimleri" 
# - "Bilgisayar ve Öğretim Teknolojileri Öğretmenliği"

results = search_lisans_programs({"program_adi": "bilgisayar"})

# "mühendislik" finds all engineering programs
engineering_programs = search_lisans_programs({"program_adi": "mühendislik"})

Universal Search | Evrensel Arama

Search both lisans and önlisans programs simultaneously:

from yokatlas_py import search_programs

# Search both program types at once
all_results = search_programs({
    "uni_adi": "anadolu",
    "program_adi": "bilgisayar"
})

print(f"Lisans programs: {len(all_results['lisans'])}")
print(f"Önlisans programs: {len(all_results['onlisans'])}")

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

New Features in v0.4.2+ | v0.4.2+'daki Yeni Özellikler

  • Smart Search: Use search_lisans_programs() and search_onlisans_programs() for better search experience
  • Fuzzy Matching: University and program names are matched intelligently
  • Complete Data: All Turkish universities and programs included

Migration Steps | Geçiş Adımları

  1. Update the package

    pip install --upgrade yokatlas-py
    
  2. Use new smart search functions (recommended)

    # Old way (still works)
    from yokatlas_py import YOKATLASLisansTercihSihirbazi
    search = YOKATLASLisansTercihSihirbazi({"universite": "BOĞAZİÇİ ÜNİVERSİTESİ"})
    
    # New way (with fuzzy matching)
    from yokatlas_py import search_lisans_programs
    results = search_lisans_programs({"uni_adi": "boğaziçi"})  # Much easier!
    
  3. Optional: Use type-safe features

    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.5.0.tar.gz (50.1 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.5.0-py3-none-any.whl (109.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yokatlas_py-0.5.0.tar.gz
  • Upload date:
  • Size: 50.1 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.5.0.tar.gz
Algorithm Hash digest
SHA256 5cd380307ea22da3ce9abf896bfc20a6a8c977ec45389b01ae9f2ff4fafb52db
MD5 583d26b85e18a30006d0eca3e65984c1
BLAKE2b-256 84b9c4b4cb0cf6188dc7fbd294807934eaa92fc6a037799375ef138ce71c2b59

See more details on using hashes here.

Provenance

The following attestation bundles were made for yokatlas_py-0.5.0.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.5.0-py3-none-any.whl.

File metadata

  • Download URL: yokatlas_py-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 109.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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 63dc4de2b5d088f0c3e5907bc15afeda031cf9ab233f570e184060e4d548a82f
MD5 20f176571b75a5903579c00f19d64966
BLAKE2b-256 50c0d7f07ac90a540081d7380e0a37a89ac5b0e3da5f4cddd651303d0c731c91

See more details on using hashes here.

Provenance

The following attestation bundles were made for yokatlas_py-0.5.0-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