# Python programlama

## Mavibot.ai'de Python kaynak kodu nasıl çalıştırılır

Bir kaynak kodunu (.py uzantısı) çalıştırmak için fonksiyon **code\_executor(URL, params)** kullanılır, burada

**URL** - kaynak koda giden URL (“<https://mavibot.ai/handler.py”> örnek olarak)

**params** - kodunuz için gerekli olan parametreler (bir JSON satırı olarak gelirler)

Dönen değer, fonksiyonun döndürdüğü şeydir

Örnek:

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

{% hint style="success" %}
Rusya IP adresinden API istekleri göndermeniz gerekiyorsa, Salebot proxy'sini kullanmanızı öneririz.

Örnek:

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

{% hint style="info" %}
`139.59.148.123` — Python kod çalıştırıcısı
{% endhint %}

**Kaynak kod için gereksinimler:**

Kodunuz, blok ayarlarında belirttiğiniz parametrelerin bir karmasını içeren bir parametreyi kabul eden bir handle(data) fonksiyonu içermelidir. Fonksiyon, çalıştırıldıktan sonra bot'a geri iletilecek bir değer döndürmelidir. Sonucu editörün parametrelerine ayırmak için, sonucu JSON olarak döndürün.

Burada görebileceğiniz örnek kod: <https://mavibot.ai/handler.py>

Standart kütüphaneleri ve aşağıda listelenenleri kullanabilirsiniz:

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

### Video özeti


---

# 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/tr/ozel-ozellikler/python-programlama.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.
