Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

سروش‌تون | Soroushthon

پایتون و حساب سروش‌پلاس؛ بقیه‌اش با ایدهٔ خودت

سروش‌تون را ساخته‌ام تا برای کارهای تکراریِ سروش‌پلاس لازم نباشد هر بار از اول با جزئیات پروتکل درگیر شوم. وقتی می‌خواهم پیام‌ها را بخوانم، فایلی بفرستم، برای یک گروه برنامه بنویسم یا به رویدادهای تازه واکنش نشان بدهم، ترجیح می‌دهم کد برنامه‌ام را ببینم، نه انبوهی از درخواست‌های ریز را.

برای همین متدهای روزمره را کوتاه و سرراست نگه داشته‌ام و راهِ استفاده از درخواست‌های خام را هم باز گذاشته‌ام. کتابخانه با حساب کاربری سروش‌پلاس و asyncio کار می‌کند؛ می‌توانی برای هر حساب نشست خودش را داشته باشی.

چند کاری که می‌شود باهاش انجام داد:

  • خواندن، جست‌وجو، فرستادن، ویرایش و حذف پیام در گفتگوی خصوصی، گروه و کانال
  • فرستادن و دریافت عکس، ویدئو، صوت، پیام صوتی و فایل
  • نوشتن برنامه‌هایی که به پیام و رویداد تازه واکنش نشان می‌دهند
  • کار با نظرسنجی، رأی و واکنش
  • خواندن اطلاعات گروه و کانال، اعضا و نقش‌ها، و بررسی عضویت کاربر مشخص
  • ساخت و فرستادن لینک نشست کنفرانس در گفتگو

یک شروع کوتاه

python -m pip install soroushthon
import asyncio
from soroushthon import SoroushClient


async def main():
    client = SoroushClient.for_account('main')
    await client.start()
    try:
        me = await client.me()
        print('شناسهٔ حساب:', me.id)

        await client.send('me', 'سلام از سروش‌تون!')

        chat = await client.bind_chat('@my_channel')
        for message in await chat.messages(limit=5):
            print(message)
    finally:
        await client.disconnect()


asyncio.run(main())

پایتون ۳٫۹ یا جدیدتر کافی است. برای حساب دوم هم می‌توانی به‌جای main یک نام دیگر مثل work بگذاری؛ نشست‌ها جدا نگه داشته می‌شوند.

اگر داری با سروش‌تون برنامه می‌سازی، خبرهای نسخه‌های تازه را می‌خواهی یا جایی از کار سؤال داری، به گپ/کانال @soroushthon در سروش‌پلاس بیا. سورس، نمونه‌ها و راهنماهای بیشتر هم در مخزن پروژه قرار دارند.

این پروژه با مجوز GPLv3 منتشر می‌شود؛ اطلاعات منشأ کدهای اقتباس‌شده همراه سورس آمده است.

Metadata

Release files for soroushthon 0.2.93.dev0

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

Source distribution (sdist)

Source distribution for soroushthon 0.2.93.dev0
File Size Uploaded Provenance
soroushthon-0.2.93.dev0.tar.gz 1.0 MB Without provenance Details

Built distribution (wheel)

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

Total release size: 1.8 MB

Release files / soroushthon-0.2.93.dev0.tar.gz

Download URL soroushthon-0.2.93.dev0.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
60a30945f8cfc4afb532d868a24eb2a00a684c5a1ab096f77cacfd793e4f650f
BLAKE2b-256 checksum
How to use checksums
6ddaec62d9ff93e926446ac60b16d63b58109e92934b377c91c11d890ef0a836
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Release files / soroushthon-0.2.93.dev0-py3-none-any.whl

Download URL soroushthon-0.2.93.dev0-py3-none-any.whl
Size 792.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a085ef4cebf190be5ae7751310476b5dd53da59c53c140643a327008a5419229
BLAKE2b-256 checksum
How to use checksums
2f9fde33564629503d66c9d1600e437b947ffa3f3e8379caa39578fa482321d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Security for soroushthon 0.2.93.dev0

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