{"id":34089494,"url":"https://github.com/yarbshk/pybitrix24","last_synced_at":"2026-04-05T01:32:27.204Z","repository":{"id":51561563,"uuid":"102022680","full_name":"yarbshk/pybitrix24","owner":"yarbshk","description":"The simplest zero dependency polyversion Python library for Bitrix24 REST API.","archived":false,"fork":false,"pushed_at":"2021-07-23T17:36:57.000Z","size":197,"stargazers_count":45,"open_issues_count":4,"forks_count":23,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-12-16T16:57:27.518Z","etag":null,"topics":["api-client","bitrix24","python","urlib"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yarbshk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-31T16:42:21.000Z","updated_at":"2025-10-12T19:13:16.000Z","dependencies_parsed_at":"2022-09-12T11:20:39.433Z","dependency_job_id":null,"html_url":"https://github.com/yarbshk/pybitrix24","commit_stats":null,"previous_names":["yarbshk/bitrix24-python3-client"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/yarbshk/pybitrix24","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yarbshk%2Fpybitrix24","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yarbshk%2Fpybitrix24/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yarbshk%2Fpybitrix24/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yarbshk%2Fpybitrix24/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yarbshk","download_url":"https://codeload.github.com/yarbshk/pybitrix24/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yarbshk%2Fpybitrix24/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31421869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T00:25:07.052Z","status":"ssl_error","status_checked_at":"2026-04-05T00:25:05.923Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","bitrix24","python","urlib"],"created_at":"2025-12-14T14:01:52.533Z","updated_at":"2026-04-05T01:32:27.199Z","avatar_url":"https://github.com/yarbshk.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pybitrix24\nThe simplest zero dependency polyversion Python library for Bitrix24 REST API.\n\n## Features\n- **Polyversion.** Supported Python versions: 2.7, 3.5+.\n- **Zero dependency.** It's fast, lightweight and secure.\n- **Reliable.** Test coverage is more than 80%.\n- **Just simple.** Examples of usage and clear sources.\n\n## Installation\nInstall using [pip](https://pip.pypa.io/en/stable/):\n\n```bash\n$ pip install pybitrix24\n```\n\n## Getting started\n\n### Preparation\n\nThe current section and next one can be skipped if only webhooks will be used.\n\nTo start making requests it's necessary to [create an application](https://training.bitrix24.com/rest_help/bitrix24_apps/index.php) in the marketplace first. Then create an instance of the main class with the minimum required configuration that contains **hostname**, **client ID** and **secret** arguments (hereafter placeholders prefixed with \"my\" will be used instead of real values):\n\n```python\n\u003e\u003e\u003e from pybitrix24 import Bitrix24\n\u003e\u003e\u003e bx24 = Bitrix24('my-subdomain.bitrix24.com', 'my.client.id', 'MyClientSecret')\n```\n\nNow is the time to authorize.\n\nBitrix24 uses [OAuth2](https://training.bitrix24.com/rest_help/oauth/authentication.php) and [authorization code grant](https://tools.ietf.org/html/rfc6749#section-1.3.1) for authorization of applications. It means that account owner's credentials are hidden from developers for security reasons, therefore, **it's not possible to obtain authorization code programmatically**. The account owner should be always present when access is granted.\n\nHowever, to make life a bit simpler there is a helper method that builds an authorization URL for requesting an authorization code:\n\n```python\n\u003e\u003e\u003e bx24.build_authorization_url()\n'https://my-subdomain.bitrix24.com/oauth/authorize/?client_id=my.client.id\u0026response_type=code'\n```\n\nFinally, when an authorization code is received both [access](https://tools.ietf.org/html/rfc6749#section-1.4) and [refresh tokens](https://tools.ietf.org/html/rfc6749#section-1.5) can be obtained: \n\n```python\n\u003e\u003e\u003e bx24.obtain_tokens('AnAuthorizationCode')\n{'access_token': 'AnAccessToken', 'refresh_token': 'ARefreshToken', ...}\n```\n\nAs it was mentioned earlier it's not possible to get the authorization code automatically but it's possible to refresh tokens after initial receiving to make the session longer (note that both **tokens have 1 hour lifetime** after that they'll be expired and an authorization code must be granted again):\n\n```python\n\u003e\u003e\u003e bx24.refresh_tokens()\n{'access_token': 'ANewAccessToken', 'refresh_token': 'ANewRefreshToken', ...}\n```\n\nCongratulations, all the preparatory work is done!\n\n### Requesting resources with an access token\n\nA further turn for requesting Bitrix24 resources. An access token injects automatically for all methods prefixed with `call_` that are mentioned in this section.\n\nTo make a **single call** (this example requires the following permissions: `user`):\n\n```python\n\u003e\u003e\u003e bx24.call('user.get', {'ID': 1})\n{'result': {...}}\n```\n\nTo make a **batch call** that is a few calls per request (this example requires the following permissions: `user,department`):\n\n```python\n\u003e\u003e\u003e bx24.call_batch({\n...     'get_user': ('user.current', {}), # or 'user.current'\n...     'get_department': {\n...         'method': 'department.get',\n...         'params': {'ID': '$result[get_user][UF_DEPARTMENT]'}\n...     }\n... })\n{'result': {'result': {...}}}\n```\n\nTo **bind an event** (this method calls `event.bind` under the hood):\n\n```python\n\u003e\u003e\u003e bx24.call_event_bind('OnAppUpdate', 'https://example.com/')\n{'result': {...}}\n```\n\nTo **unbind an event** (this method calls `event.unbind` under the hood):\n\n```python\n\u003e\u003e\u003e bx24.call_event_unbind('OnAppUpdate', 'https://example.com/')\n{'result': {...}}\n```\n\n### Requesting resources with a webhook code\n\nRequesting resources with an authorization code is suitable for development of 3rd-party applications that are often quite cumbersome. However, sometimes it's enough to send a few simple calls. This is where webhooks come to action. \n\nIf only webhooks are used the minimum required configuration is as simple as the following (use `user_id` argument if you need to make webhook calls on behalf of another user, by default `1` is used):\n\n```python\n\u003e\u003e\u003e from pybitrix24 import Bitrix24\n\u003e\u003e\u003e bx24 = Bitrix24('my-subdomain.bitrix24.com')\n```\n\nTo make an **inbound webhook** call (this example requires the following permissions: `user`):\n\n```python\n\u003e\u003e\u003e bx24.call_webhook('xxxxxxxxxxxxxxxx', 'user.get', {'ID': 1})\n{'result': {...}}\n```\n\nTo make a batch call of **inbound webhooks** (this example requires the following permissions: `user,department`):\n\n```python\n\u003e\u003e\u003e bx24.call_batch_webhook('xxxxxxxxxxxxxxxx', {\n...     'get_user': ('user.current', {}), # or 'user.current'\n...     'get_department': {\n...         'method': 'department.get',\n...         'params': {'ID': '$result[get_user][UF_DEPARTMENT]'}\n...     }\n... })\n{'result': {'result': {...}}}\n```\n\nThat's the end of the quick introduction. Thanks!\n\nFor more details, please, [explore source code](pybitrix24/bitrix24.py) or [ask me](https://github.com/yarbshk/pybitrix24/issues/new). Good luck!\n\n## Copyright and License\nCopyright © 2017-2020 Yurii Rabeshko. Code released under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyarbshk%2Fpybitrix24","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyarbshk%2Fpybitrix24","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyarbshk%2Fpybitrix24/lists"}