# برمجة بايثون

## كيفية تشغيل شفرة مصدر بايثون في Mavibot.ai

لتشغيل شفرة مصدر (امتداد .py) تُستخدم الدالة **code\_executor(URL, params)** ، حيث

**URL** - عنوان URL لشفرة المصدر («<https://mavibot.ai/handler.py»> كمثال)

**params** - المعلمات المطلوبة لشفرتك (تأتي كسطر JSON)

القيمة المعادة هي ما تُرجِعه الدالة

مثال:

![](https://lh5.googleusercontent.com/LS-DvyjzFkpV6FMf1xDu_lgBMle_VulqC6M2W1SIQdu_q7GzALODAfVzU4Xu41O-hk7_hRJvAxHL-GHzqWT5Gmn5WYntvr-KdmgxhBPqxxQ14l5Vs7cuPIkLEnisPcrFoCkLKiKfEky3VgOsDg)

{% hint style="success" %}
إذا كنت بحاجة إلى إرسال طلبات API من عنوان IP روسي، فنوصي باستخدام وكيل Salebot.

مثال:

requests.get('<https://google.com>', proxies={'https': '[http://51.250.88.121:24532'}).text](https://docs.mavibot.ai/doc/ar/myzat-khash/http:/51.250.88.121:24532'}\).text)
{% endhint %}

{% hint style="info" %}
`139.59.148.123` — منفّذ شفرة بايثون
{% endhint %}

**متطلبات شفرة المصدر:**

يجب أن تتضمن شيفرتك الدالة handle(data) التي تقبل وسيطًا يحتوي على تجزئة للمعلمات التي حدّدتها في إعدادات الكتلة. يجب أن تُرجِع الدالة قيمة ستُعاد إلى البوت بعد التنفيذ. لتقسيم النتيجة إلى معلمات المحرر، أعدها بصيغة JSON.

يمكنك رؤية مثال للشيفرة هنا: <https://mavibot.ai/handler.py>

يمكنك استخدام المكتبات القياسية، بالإضافة إلى تلك المدرجة أدناه:

requests \
logger \
gspread \
oauth2client \
numpy \
pyzbar \
fuzzywuzzy \
python-Levenshtein \
re \
urllib \
time \
json \
hmac \
hashlib \
beautifulsoup4 \
pandas \
base64 \
xmltodict \
mysql-connector-python \
zeep \
Google-api-python-client

### نظرة عامة بالفيديو


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mavibot.ai/doc/ar/myzat-khash/brmjh-baythwn.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
