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.1.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.1-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sitwatch-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 7106fd0d34686f0d27dd1bb0ced5ce2b234e6997422545fe2c9e24987e614dd6
MD5 b180828fcdc0b5055b084501037949de
BLAKE2b-256 21cc51596ec16f0357003e2af1952bd22e1b5f2badd66c3974de2d5de20f4697

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sitwatch-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4f767da9b5b0c39e0a3f2553496af2eb286050cc5ea5fb2d6b0bebe947bfc5ee
MD5 143109f6bedd83a50b3ab9b31fabaa6e
BLAKE2b-256 afeaafd22fa34bf4912d2eb2817dd51d2d00edb1858e648aa305e1cfa47edfbe

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