yandex-b2b-go


Nameyandex-b2b-go JSON
Version 1.0.2 PyPI version JSON
download
home_pageNone
SummaryYandex GO for Business SDK
upload_time2024-09-25 07:27:52
maintainerNone
docs_urlNone
authorYandex LLC
requires_python>=3.8
licenseMIT
keywords yandex go b2b sdk library api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Yandex Go for Business SDK (Python)

---

Officially supported Python client for Yandex Go for Business

---

**Documentation**: <a href="https://taxi__business-api.docs-viewer.yandex.ru/ru/" target="_blank">https://taxi__business-api.docs-viewer.yandex.ru/ru/

---

## Quickstart

### Prerequisites

- Python 3.8 or higher
- `pip` version 9.0.1 or higher

If necessary, upgrade your version of `pip`:

```sh
$ python -m pip install --upgrade pip
```

If you cannot upgrade `pip` due to a system-owned installation, you can
run the example in a virtualenv:

```sh
$ python -m pip install virtualenv
$ virtualenv venv
$ source venv/bin/activate
$ python -m pip install --upgrade pip
```

Install Yandex Go for Business SDK:

```sh
$ python -m pip install yandex_b2b_go
```

## Getting started

Your requests are authorized via an OAuth token.

```python
client = yandex_b2b_go.Client(token='y2_...')
```

Or you can use context manager
```python
async with yandex_b2b_go.Client(token='y2_...') as client:
    pass
```

---

## Get user list

Example method for get users list.
```python
import yandex_b2b_go

TOKEN = 'y2_...'
client = yandex_b2b_go.Client(token=TOKEN)
user_manager = yandex_b2b_go.UserManager(client=client)
users = await user_manager.list(limit=20, cursor='djEgMTY2M...MGM3OTE=')
```

This method return class `UserListResponse`

---

## Get user create

Example method for user create.
```python
import yandex_b2b_go

TOKEN = 'y2_...'
client = yandex_b2b_go.Client(token=TOKEN)
user_manager = yandex_b2b_go.UserManager(client=client)
user = yandex_b2b_go.typing.User(
    fullname='Иванов Илья',
    phone='+79990000000',
    is_active=True,
)
response = await user_manager.create(user=user)
```

This method return class `UserCreateResponse`

---

## Class Client have parameters
- `timeout` - the time in seconds to limit the execution of the request
- `log_level` - the logging level for a specific method. Default `logging.INFO`
- `log_request` - whether to log the entire request. Default `False`
- `log_response` - whether to log the entire response. Default `False`

## Example

Set `log_level = WARNING` and `log_request = True`

```python
import logging
import yandex_b2b_go

TOKEN = 'y2_...'
client = yandex_b2b_go.Client(token=TOKEN, log_level=logging.WARNING, log_request=True)
user_manager = yandex_b2b_go.UserManager(client=client)
users = await user_manager.list(limit=1)
```
Output:
```commandline
2024-09-17 16:20:03,166 WARNING Request=GET, for url=https://b2b-api.go.yandex.ru/integration/2.0/users?limit=1, params={'limit': '1'}, body=None
2024-09-17 16:20:03,814 WARNING GET request https://b2b-api.go.yandex.ru/integration/2.0/users success with status code 200
```

---

Set `log_response = True`
```python
import yandex_b2b_go

TOKEN = 'y2_...'
client = yandex_b2b_go.Client(token=TOKEN, log_response=True)
user_manager = yandex_b2b_go.UserManager(client=client)
users = await user_manager.list(limit=1)
```
Output:
```commandline
2024-09-17 16:22:22,995 INFO Performing GET request to https://b2b-api.go.yandex.ru/integration/2.0/users
2024-09-17 16:22:23,276 INFO GET request https://b2b-api.go.yandex.ru/integration/2.0/users success with status code 200, body={'items': [{'fullname': 'Иванов Илья', 'is_active': True, 'phone': '+79990000000', 'id': '0516587…..c5a8adb58', 'is_deleted': False, 'cost_center': '', 'department_id': '9080a2……208a1856', 'email': 'email1@email.ru', 'limits': [{'limit_id': 'e31cc52437...', 'service': 'eats2'}, {'limit_id': '4afef98...', 'service': 'drive'}, {'limit_id': '20569bb9d...', 'service': 'taxi'}], 'nickname': 'id1234572', 'client_id': '1f300a6…..edf867021c'}], 'limit': 1, 'total_amount': 20, 'next_cursor': 'djEgMTY2NjA3OTAN….GM4MTgwMDFlNTAzYjg3NTQ='}
```

---
## Contributing
### Dependencies
Use `make deps` command to install library, its production and development dependencies.

### Formatting
Use `make format` to autoformat code with black tool.

### Tests
- `make test` to run tests for current python version
- `make lint` to run only linters for current python version

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "yandex-b2b-go",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "yandex, go, b2b, sdk, library, api",
    "author": "Yandex LLC",
    "author_email": "b2b-go@yandex-team.ru",
    "download_url": "https://files.pythonhosted.org/packages/1b/69/24df84fd4cc7cfe034567ed88efa59d9156052be12681d61df9fd0e78495/yandex_b2b_go-1.0.2.tar.gz",
    "platform": null,
    "description": "# Yandex Go for Business SDK (Python)\n\n---\n\nOfficially supported Python client for Yandex Go for Business\n\n---\n\n**Documentation**: <a href=\"https://taxi__business-api.docs-viewer.yandex.ru/ru/\" target=\"_blank\">https://taxi__business-api.docs-viewer.yandex.ru/ru/\n\n---\n\n## Quickstart\n\n### Prerequisites\n\n- Python 3.8 or higher\n- `pip` version 9.0.1 or higher\n\nIf necessary, upgrade your version of `pip`:\n\n```sh\n$ python -m pip install --upgrade pip\n```\n\nIf you cannot upgrade `pip` due to a system-owned installation, you can\nrun the example in a virtualenv:\n\n```sh\n$ python -m pip install virtualenv\n$ virtualenv venv\n$ source venv/bin/activate\n$ python -m pip install --upgrade pip\n```\n\nInstall Yandex Go for Business SDK:\n\n```sh\n$ python -m pip install yandex_b2b_go\n```\n\n## Getting started\n\nYour requests are authorized via an OAuth token.\n\n```python\nclient = yandex_b2b_go.Client(token='y2_...')\n```\n\nOr you can use context manager\n```python\nasync with yandex_b2b_go.Client(token='y2_...') as client:\n    pass\n```\n\n---\n\n## Get user list\n\nExample method for get users list.\n```python\nimport yandex_b2b_go\n\nTOKEN = 'y2_...'\nclient = yandex_b2b_go.Client(token=TOKEN)\nuser_manager = yandex_b2b_go.UserManager(client=client)\nusers = await user_manager.list(limit=20, cursor='djEgMTY2M...MGM3OTE=')\n```\n\nThis method return class `UserListResponse`\n\n---\n\n## Get user create\n\nExample method for user create.\n```python\nimport yandex_b2b_go\n\nTOKEN = 'y2_...'\nclient = yandex_b2b_go.Client(token=TOKEN)\nuser_manager = yandex_b2b_go.UserManager(client=client)\nuser = yandex_b2b_go.typing.User(\n    fullname='\u0418\u0432\u0430\u043d\u043e\u0432 \u0418\u043b\u044c\u044f',\n    phone='+79990000000',\n    is_active=True,\n)\nresponse = await user_manager.create(user=user)\n```\n\nThis method return class `UserCreateResponse`\n\n---\n\n## Class Client have parameters\n- `timeout` - the time in seconds to limit the execution of the request\n- `log_level` - the logging level for a specific method. Default `logging.INFO`\n- `log_request` - whether to log the entire request. Default `False`\n- `log_response` - whether to log the entire response. Default `False`\n\n## Example\n\nSet `log_level = WARNING` and `log_request = True`\n\n```python\nimport logging\nimport yandex_b2b_go\n\nTOKEN = 'y2_...'\nclient = yandex_b2b_go.Client(token=TOKEN, log_level=logging.WARNING, log_request=True)\nuser_manager = yandex_b2b_go.UserManager(client=client)\nusers = await user_manager.list(limit=1)\n```\nOutput:\n```commandline\n2024-09-17 16:20:03,166 WARNING Request=GET, for url=https://b2b-api.go.yandex.ru/integration/2.0/users?limit=1, params={'limit': '1'}, body=None\n2024-09-17 16:20:03,814 WARNING GET request https://b2b-api.go.yandex.ru/integration/2.0/users success with status code 200\n```\n\n---\n\nSet `log_response = True`\n```python\nimport yandex_b2b_go\n\nTOKEN = 'y2_...'\nclient = yandex_b2b_go.Client(token=TOKEN, log_response=True)\nuser_manager = yandex_b2b_go.UserManager(client=client)\nusers = await user_manager.list(limit=1)\n```\nOutput:\n```commandline\n2024-09-17 16:22:22,995 INFO Performing GET request to https://b2b-api.go.yandex.ru/integration/2.0/users\n2024-09-17 16:22:23,276 INFO GET request https://b2b-api.go.yandex.ru/integration/2.0/users success with status code 200, body={'items': [{'fullname': '\u0418\u0432\u0430\u043d\u043e\u0432 \u0418\u043b\u044c\u044f', 'is_active': True, 'phone': '+79990000000', 'id': '0516587\u2026..c5a8adb58', 'is_deleted': False, 'cost_center': '', 'department_id': '9080a2\u2026\u2026208a1856', 'email': 'email1@email.ru', 'limits': [{'limit_id': 'e31cc52437...', 'service': 'eats2'}, {'limit_id': '4afef98...', 'service': 'drive'}, {'limit_id': '20569bb9d...', 'service': 'taxi'}], 'nickname': 'id1234572', 'client_id': '1f300a6\u2026..edf867021c'}], 'limit': 1, 'total_amount': 20, 'next_cursor': 'djEgMTY2NjA3OTAN\u2026.GM4MTgwMDFlNTAzYjg3NTQ='}\n```\n\n---\n## Contributing\n### Dependencies\nUse `make deps` command to install library, its production and development dependencies.\n\n### Formatting\nUse `make format` to autoformat code with black tool.\n\n### Tests\n- `make test` to run tests for current python version\n- `make lint` to run only linters for current python version\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Yandex GO for Business SDK",
    "version": "1.0.2",
    "project_urls": null,
    "split_keywords": [
        "yandex",
        " go",
        " b2b",
        " sdk",
        " library",
        " api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4e2f95669bde633c4f329db3c87bfcfd36120e14109c01b6ac41e2cbef5511e9",
                "md5": "730830981fc9556c94b2eb4c8f9bdfd4",
                "sha256": "70f6b1bfdde08ea61e7e9d64f03e89bd38a665619c35b7685dac200aa307c932"
            },
            "downloads": -1,
            "filename": "yandex_b2b_go-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "730830981fc9556c94b2eb4c8f9bdfd4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 34292,
            "upload_time": "2024-09-25T07:27:51",
            "upload_time_iso_8601": "2024-09-25T07:27:51.155851Z",
            "url": "https://files.pythonhosted.org/packages/4e/2f/95669bde633c4f329db3c87bfcfd36120e14109c01b6ac41e2cbef5511e9/yandex_b2b_go-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1b6924df84fd4cc7cfe034567ed88efa59d9156052be12681d61df9fd0e78495",
                "md5": "cbf8eeb55997896c07ac70ca62a0c91e",
                "sha256": "e391d309626f5829bce536d37f6370bf7d2cc2b72cf321af58deeb829a8b40aa"
            },
            "downloads": -1,
            "filename": "yandex_b2b_go-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "cbf8eeb55997896c07ac70ca62a0c91e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 78664,
            "upload_time": "2024-09-25T07:27:52",
            "upload_time_iso_8601": "2024-09-25T07:27:52.901655Z",
            "url": "https://files.pythonhosted.org/packages/1b/69/24df84fd4cc7cfe034567ed88efa59d9156052be12681d61df9fd0e78495/yandex_b2b_go-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-25 07:27:52",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "yandex-b2b-go"
}
        
Elapsed time: 0.45424s