---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://yandex.ru/dev/direct/doc/en/python3.md
  - https://yandex.ru/dev/direct/doc/ru/python3.md
  - href: en/python3.md
    type: text/markdown
    title: Markdown version
  - href: llms.txt
    type: text/markdown
    title: llms.txt
sourcePath: en/examples/python3.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.ru/dev/direct/doc/en/llms.txt

# Examples for Python 2 or 3

[Obtaining a token](https://yandex.ru/dev/direct/doc/en/python3-requests-token.md) with the flask and requests libraries

**JSON with the Requests library**

- [Get campaigns](https://yandex.ru/dev/direct/doc/en/python3-requests-campaigns.md)
- [Create ads](https://yandex.ru/dev/direct/doc/en/python3-requests-ads.md)
- [Handle error 152 “Insufficient points”](https://yandex.ru/dev/direct/doc/en/python3-requests-points.md)
- [Get statistics for any dates](https://yandex.ru/dev/direct/doc/en/python3_requests_stat1.md)
- [Get statistics for a selection of rows](https://yandex.ru/dev/direct/doc/en/python3_requests_stat2.md)

**SOAP with the Suds library**

 
- [Get campaigns](https://yandex.ru/dev/direct/doc/en/python3-suds-campaigns.md)
- [Create ads](https://yandex.ru/dev/direct/doc/en/python3-suds-ads.md)

**XML with the Requests and PyXB libraries**

- [Get statistics for any dates](https://yandex.ru/dev/direct/doc/en/python3_pyxb_stat1.md)
- [Get statistics for a selection of rows](https://yandex.ru/dev/direct/doc/en/python3_pyxb_stat2.md)

## Installing additional libraries{#python-modules}

You can use the pip utility for installing libraries (Flask, Requests, Suds, PyXB, and others):
```
pip install %package_name%
```

The pip utility is included in Python 2 beginning with version 2.7.9, and in Python 3 beginning with version 3.4. If you are using an earlier version of Python, you need to install pip. For example, you can use the script [https://bootstrap.pypa.io/get-pip.py](https://bootstrap.pypa.io/get-pip.py).

For more information, see [https://packaging.python.org/tutorials/installing-packages/](https://packaging.python.org/tutorials/installing-packages/).

