Skip to main content

SitWatch platformu için resmi Python API istemcisi

Project description

SitWatch API İstemcisi

SitWatch platformu için resmi Python API istemcisi. Bu modül ile SitWatch API'sine kolayca erişebilir ve tüm özellikleri kullanabilirsiniz.

SitWatch Logo

📋 İçindekiler

✨ Özellikler

  • ✅ Tam API Desteği
  • 🔒 Güvenli Kimlik Doğrulama
  • 🎥 Video İşlemleri
  • 👥 Kullanıcı İşlemleri
  • 💬 Topluluk Özellikleri
  • 🔍 Gelişmiş Arama
  • 📊 İstatistikler
  • 🚀 Async/Await Desteği
  • 📝 Kapsamlı Dokümantasyon

📦 Kurulum

pip install sitwatch

🚀 Hızlı Başlangıç

import asyncio
from sitwatch import SitWatch

async def main():
    # İstemciyi oluştur
    client = SitWatch()
    
    # Giriş yap
    await client.login('kullanici_adi', 'sifre')
    
    # Trend videoları al
    trending = await client.get_trending_videos()
    
    # Sonuçları göster
    for video in trending:
        print(f"{video['title']} - {video['views']} izlenme")

# Çalıştır
asyncio.run(main())

📚 Detaylı Kullanım

🔐 Kimlik Doğrulama

# İstemciyi özel yapılandırma ile oluştur
client = SitWatch({
    'base_url': 'https://api.sitwatch.net/api',
    'token': 'mevcut_token',  # İsteğe bağlı
    'on_token_change': lambda token: print(f'Token değişti: {token}')  # İsteğe bağlı
})

# Giriş yap
response = await client.login('kullanici_adi', 'sifre')

# Token kontrolü
if client.has_valid_token():
    print('Giriş başarılı!')

# Çıkış yap
await client.logout()

🎥 Video İşlemleri

# Video bilgisi al
video = await client.get_video_info(123)

# Video ara
results = await client.search_videos({
    'query': 'python',
    'sort_by': 'views',
    'page': 1,
    'per_page': 10,
    'filter_approved': True
})

# Trend videoları al
trending = await client.get_trending_videos()

# En son videoları al
latest = await client.get_latest_videos()

# Top 50 videoları al
top50 = await client.get_top50_videos()

# Video raporla
await client.report_video(123, 'Uygunsuz içerik')

👥 Kullanıcı İşlemleri

# Kullanıcı profili al
profile = await client.get_user_profile('kullanici_adi')

# Kullanıcı videolarını al
videos = await client.get_user_videos(user_id)

# En çok abonesi olanları al
top_users = await client.get_top_subscribers()

# Önerilen kullanıcıları al
recommended = await client.get_recommended_users()

# Aktif kullanıcıları al
active = await client.get_active_users()

💬 Topluluk İşlemleri

# Topluluk gönderilerini al
posts = await client.get_community_posts({
    'page': 1,
    'per_page': 10
})

# Video yorumlarını al
comments = await client.get_video_comments(video_id)

# İzleme geçmişini al
history = await client.get_watch_history()

# Bildirimleri al
notifications = await client.get_notifications()

🎯 Örnekler

Video Arama ve Filtreleme

# Gelişmiş arama örneği
results = await client.search_videos({
    'query': 'python dersleri',
    'type': 'video',
    'sort_by': 'views',
    'page': 1,
    'per_page': 20,
    'filter_approved': True,
    'min_views': 1000,
    'max_duration': 3600,  # 1 saat
    'upload_date_after': '2024-01-01'
})

# Sonuçları işle
for video in results['results']:
    print(f"""
    Başlık: {video['title']}
    İzlenme: {video['views']}
    Süre: {video['duration']} saniye
    Yükleyen: {video['uploader']['username']}
    """)

Token Yönetimi

def on_token_change(token):
    if token:
        # Token'ı kaydet
        save_token(token)
    else:
        # Token'ı sil
        delete_token()

client = SitWatch({
    'on_token_change': on_token_change,
    'token': load_saved_token()  # Kaydedilmiş token'ı yükle
})

❌ Hata Yönetimi

try:
    await client.login('kullanici_adi', 'yanlis_sifre')
except Exception as e:
    print(f"Hata: {e['message']}")
    print(f"Durum Kodu: {e['status']}")
    if 'data' in e:
        print(f"Detay: {e['data']}")

📄 Lisans

Bu proje MIT lisansı altında lisanslanmıştır.

🤝 İletişim

🙏 Teşekkürler

Bu projeyi desteklediğiniz için teşekkürler!

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

sitwatch-1.0.2.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

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

sitwatch-1.0.2-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file sitwatch-1.0.2.tar.gz.

File metadata

  • Download URL: sitwatch-1.0.2.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for sitwatch-1.0.2.tar.gz
Algorithm Hash digest
SHA256 20bd92687ec5f2adbdbee3f2ea2e7d70c432aca6547d52d73a75133c40d4b65c
MD5 fca162ac58f984e6c741bf7781807bb2
BLAKE2b-256 14f4448f5cb4d6e509c6d857dd03dd60842536b8b52ce09a1e4c5a0e71721224

See more details on using hashes here.

File details

Details for the file sitwatch-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: sitwatch-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for sitwatch-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 86704c757a9e6a00422f1f3e6ac0d6c4f39dcf91d80a35ae262e5ac2abea299a
MD5 3d10ed706a84a76902946f634ecec88f
BLAKE2b-256 18851fcb57aa241957efce1b502a4c1034bf6ef61569031a90251c4cbcf170e0

See more details on using hashes here.

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