yandex-b2b-go


Nameyandex-b2b-go JSON
Version 1.0.4 PyPI version JSON
download
home_pageNone
SummaryYandex GO for Business SDK
upload_time2024-11-07 12:48:22
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/eb/ec/df0d758390034173be6aec18ca689de8b64b5449110441e50901f5427fe6/yandex_b2b_go-1.0.4.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.4",
    "project_urls": null,
    "split_keywords": [
        "yandex",
        " go",
        " b2b",
        " sdk",
        " library",
        " api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "471b1d848ce893e02a09e2125b31ad818624238a07c97b853c297180c2566b4b",
                "md5": "2adc97066b9dd753f1d965f3690cd0f5",
                "sha256": "e512f7b21e98ee86557e706e086ec351ab1c012e6635bb6465442d3c20b1efc7"
            },
            "downloads": -1,
            "filename": "yandex_b2b_go-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2adc97066b9dd753f1d965f3690cd0f5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 36900,
            "upload_time": "2024-11-07T12:48:21",
            "upload_time_iso_8601": "2024-11-07T12:48:21.074384Z",
            "url": "https://files.pythonhosted.org/packages/47/1b/1d848ce893e02a09e2125b31ad818624238a07c97b853c297180c2566b4b/yandex_b2b_go-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ebecdf0d758390034173be6aec18ca689de8b64b5449110441e50901f5427fe6",
                "md5": "c84c183ec50dfd82ca8882efb6d9d206",
                "sha256": "73ff6f94fd7e3ddce95f84d7a447f59f70143aae75cfbbee3c50ee17f0648518"
            },
            "downloads": -1,
            "filename": "yandex_b2b_go-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "c84c183ec50dfd82ca8882efb6d9d206",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 95001,
            "upload_time": "2024-11-07T12:48:22",
            "upload_time_iso_8601": "2024-11-07T12:48:22.492714Z",
            "url": "https://files.pythonhosted.org/packages/eb/ec/df0d758390034173be6aec18ca689de8b64b5449110441e50901f5427fe6/yandex_b2b_go-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-07 12:48:22",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "yandex-b2b-go"
}
        
Elapsed time: 1.66746s