b24pysdk 0.1.0a1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- b24pysdk-0.1.0a1/LICENSE +21 -0
- b24pysdk-0.1.0a1/PKG-INFO +164 -0
- b24pysdk-0.1.0a1/README.md +127 -0
- b24pysdk-0.1.0a1/b24pysdk/__init__.py +32 -0
- b24pysdk-0.1.0a1/b24pysdk/__main__.py +10 -0
- b24pysdk-0.1.0a1/b24pysdk/_client.py +110 -0
- b24pysdk-0.1.0a1/b24pysdk/_config.py +96 -0
- b24pysdk-0.1.0a1/b24pysdk/_constants.py +25 -0
- b24pysdk-0.1.0a1/b24pysdk/_version.py +4 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/__init__.py +14 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/bitrix_app.py +51 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/bitrix_token.py +312 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/classes/__init__.py +29 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/classes/bitrix_api_response_time.py +41 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/classes/request/__init__.py +11 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/classes/request/bitrix_api_batch_request.py +219 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/classes/request/bitrix_api_list_request.py +125 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/classes/request/bitrix_api_request.py +138 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/classes/response/__init__.py +11 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/classes/response/bitrix_api_batch_response.py +83 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/classes/response/bitrix_api_list_response.py +61 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/classes/response/bitrix_api_response.py +46 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/functions/__init__.py +23 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/functions/_base_caller.py +50 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/functions/call.py +45 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/functions/call_batch.py +160 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/functions/call_batches.py +201 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/functions/call_list.py +269 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/functions/call_list_fast.py +388 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/functions/call_method.py +94 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/functions/parse_response.py +130 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/requesters/__init__.py +7 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/requesters/_base_requester.py +29 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/requesters/bitrix_api_requester.py +134 -0
- b24pysdk-0.1.0a1/b24pysdk/bitrix_api/requesters/oauth_requester.py +83 -0
- b24pysdk-0.1.0a1/b24pysdk/error.py +287 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/__init__.py +11 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/base.py +73 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/__init__.py +124 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/_productrows.py +51 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/_userfield.py +87 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/activity/__init__.py +5 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/activity/activity.py +253 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/activity/badge.py +149 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/activity/binding.py +182 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/activity/communication.py +40 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/activity/configurable.py +156 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/activity/layout/__init__.py +5 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/activity/layout/blocks.py +146 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/activity/layout/layout.py +19 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/activity/todo.py +341 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/activity/type.py +104 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/address.py +215 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/automatedsolution.py +184 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/automation/__init__.py +5 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/automation/automation.py +11 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/automation/trigger.py +186 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/base_crm.py +129 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/calllist/__init__.py +5 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/calllist/calllist.py +245 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/calllist/items.py +57 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/category.py +241 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/company.py +251 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/contact.py +255 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/currency/__init__.py +5 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/currency/base.py +75 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/currency/currency.py +230 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/currency/localizations.py +147 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/deal/__init__.py +5 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/deal/deal.py +269 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/deal/recurring.py +240 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/details/__init__.py +5 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/details/configuration.py +187 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/details/details.py +11 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/documentgenerator/__init__.py +5 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/documentgenerator/document.py +346 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/documentgenerator/documentgenerator.py +22 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/documentgenerator/numerator.py +158 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/documentgenerator/template.py +247 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/duplicate/__init__.py +7 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/duplicate/duplicate.py +75 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/duplicate/entity.py +47 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/duplicate/volatile_type.py +156 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/enum/__init__.py +5 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/enum/enum.py +244 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/enum/settings.py +39 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/item/__init__.py +5 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/item/base_item.py +355 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/item/delivery.py +111 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/item/details/__init__.py +5 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/item/details/base_configuration.py +224 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/item/details/configuration.py +176 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/item/details/details.py +20 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/item/item.py +401 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/item/payment/__init__.py +5 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/item/payment/delivery.py +179 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/item/payment/payment.py +274 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/item/payment/product.py +183 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/item/productrow.py +290 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/lead.py +260 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/multifield.py +28 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/orderentity.py +164 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/quote.py +229 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/relationships/__init__.py +7 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/relationships/company.py +100 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/relationships/contact.py +117 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/relationships/items.py +125 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/relationships/relationship.py +119 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/requisite/__init__.py +5 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/requisite/detail/__init__.py +7 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/requisite/detail/bankdetail.py +194 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/requisite/detail/detail.py +181 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/requisite/detail/preset/__init__.py +5 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/requisite/detail/preset/field.py +277 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/requisite/detail/preset/preset.py +223 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/requisite/link.py +234 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/requisite/requisite.py +242 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/stagehistory.py +81 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/status/__init__.py +5 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/status/entity.py +72 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/status/status.py +234 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/timeline/__init__.py +5 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/timeline/bindings.py +160 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/timeline/comment.py +254 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/timeline/image/__init__.py +7 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/timeline/image/icon.py +115 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/timeline/image/image.py +125 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/timeline/image/logo.py +115 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/timeline/logmessage.py +164 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/timeline/note.py +161 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/timeline/timeline.py +40 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/type.py +220 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/userfield/__init__.py +5 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/userfield/enumeration.py +37 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/userfield/settings.py +49 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/userfield/userfield.py +66 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/crm/vat.py +190 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/department.py +154 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/scope.py +70 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/socialnetwork/__init__.py +19 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/socialnetwork/api.py +11 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/socialnetwork/workgroup.py +65 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/user/__init__.py +140 -0
- b24pysdk-0.1.0a1/b24pysdk/scopes/user/userfield.py +93 -0
- b24pysdk-0.1.0a1/b24pysdk/utils/__init__.py +0 -0
- b24pysdk-0.1.0a1/b24pysdk/utils/encoding.py +82 -0
- b24pysdk-0.1.0a1/b24pysdk/utils/functional.py +77 -0
- b24pysdk-0.1.0a1/b24pysdk/utils/types.py +126 -0
- b24pysdk-0.1.0a1/b24pysdk/version.py +5 -0
- b24pysdk-0.1.0a1/b24pysdk.egg-info/PKG-INFO +164 -0
- b24pysdk-0.1.0a1/b24pysdk.egg-info/SOURCES.txt +154 -0
- b24pysdk-0.1.0a1/b24pysdk.egg-info/dependency_links.txt +1 -0
- b24pysdk-0.1.0a1/b24pysdk.egg-info/requires.txt +5 -0
- b24pysdk-0.1.0a1/b24pysdk.egg-info/top_level.txt +2 -0
- b24pysdk-0.1.0a1/pyproject.toml +99 -0
- b24pysdk-0.1.0a1/setup.cfg +4 -0
b24pysdk-0.1.0a1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Bitrix24
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: b24pysdk
|
|
3
|
+
Version: 0.1.0a1
|
|
4
|
+
Summary: An official Python library for the Bitrix24 REST API
|
|
5
|
+
Author-email: Bitrix24 <pypi@bitrixsoft.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 Bitrix24
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/bitrix24/b24pysdk
|
|
29
|
+
Keywords: bitrix24,rest,api
|
|
30
|
+
Requires-Python: >=3.9
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
License-File: LICENSE
|
|
33
|
+
Requires-Dist: requests<3,>=2.32.4
|
|
34
|
+
Provides-Extra: dev
|
|
35
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
36
|
+
Requires-Dist: ruff; extra == "dev"
|
|
37
|
+
|
|
38
|
+
# Introduction
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
B24PySDK is the official library for working with the Bitrix24 REST API in Python.
|
|
43
|
+
|
|
44
|
+
It offers following advantages:
|
|
45
|
+
1. Supports authorization via tokens and webhooks;
|
|
46
|
+
2. Allows to pass arguments and retreive response data as native Python types;
|
|
47
|
+
3. Utilizes type hints to show possible method arguments and their types;
|
|
48
|
+
4. Checks that passed arguments have valid types.
|
|
49
|
+
|
|
50
|
+
# Documentation
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
The REST API documentation can be found on [Bitrix24 REST API](https://apidocs.bitrix24.com/).
|
|
55
|
+
|
|
56
|
+
# Quickstart
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
This section provides a short guide to help you get started with B24PySDK.
|
|
61
|
+
|
|
62
|
+
The following examples illustrate common scenarios when using the library.
|
|
63
|
+
## Calling an API method
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
To call Bitrix API, import Client and BitrixWebhook or BitrixToken classes from the library and create class objects.
|
|
68
|
+
There are two ways of calling API methods via library.
|
|
69
|
+
1. Using a permanent incoming local webhook code: https://apidocs.bitrix24.com/local-integrations/local-webhooks.html
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from b24pysdk import BitrixWebhook, Client
|
|
73
|
+
|
|
74
|
+
bitrix_token = BitrixWebhook(domain="your_bitrix_portal", auth_token="key_of_your_webhook")
|
|
75
|
+
client = Client(bitrix_token)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
2. Using a temporary OAuth 2.0 authorization token: https://apidocs.bitrix24.com/api-reference/oauth/index.html
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from b24pysdk import BitrixToken, Client, BitrixApp
|
|
82
|
+
|
|
83
|
+
bitrix_app = BitrixApp(client_id="app_code", client_secret="app_key")
|
|
84
|
+
bitrix_token = BitrixToken(
|
|
85
|
+
domain="your_bitrix_portal",
|
|
86
|
+
auth_token="key_of_your_webhook",
|
|
87
|
+
refresh_token="refresh_token_of_the_app", # optional parameter
|
|
88
|
+
bitrix_app=bitrix_app,
|
|
89
|
+
)
|
|
90
|
+
client = Client(bitrix_token)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Client class is your access point to the API. All supported methods can be called using properties of created instance.
|
|
94
|
+
|
|
95
|
+
For example, to get a description of deal fields we can use REST method crm.deal.fields like so:
|
|
96
|
+
```python
|
|
97
|
+
response = client.crm.deal.fields()
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Passing parameters in API calls
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
Most of Bitrix REST API methods allow you to pass some arguments to them. In order to send them using SDK, simply pass these arguments as positional or named arguments to the corresponding Python function.
|
|
105
|
+
|
|
106
|
+
To illustrate, we can update a deal by calling:
|
|
107
|
+
```python
|
|
108
|
+
response = client.crm.deal.get(bitrix_id=2)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Retrieving results of the call
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
B24PySDK uses deferred method calls. To invoke a method and obtain its result, access the corresponding property.
|
|
116
|
+
The JSON response retrieved from the server is automatically parsed and stored in an object:
|
|
117
|
+
response.result contains the value returned by the API method, while response.time provides the execution time of the request.
|
|
118
|
+
```python
|
|
119
|
+
from b24pysdk import BitrixWebhook, Client
|
|
120
|
+
|
|
121
|
+
bitrix_token = BitrixWebhook(domain="your_bitrix_portal", auth_token="key_of_your_webhook")
|
|
122
|
+
client = Client(bitrix_token)
|
|
123
|
+
|
|
124
|
+
response = client.crm.deal.update(bitrix_id=10, fields={'TITLE': 'New title'})
|
|
125
|
+
print(f'Updated successfully: {response.result}')
|
|
126
|
+
print(f'Call took {response.time.duration} seconds')
|
|
127
|
+
```
|
|
128
|
+
```
|
|
129
|
+
Updated successfully: True
|
|
130
|
+
Call took 0.40396690368652344 seconds
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Retrieving records with list methods
|
|
134
|
+
|
|
135
|
+
For list methods, you can use .as_list() and .as_list_fast() to explicitly retrieve all records.
|
|
136
|
+
> Documentation: https://apidocs.bitrix24.com/api-reference/performance/huge-data.html
|
|
137
|
+
|
|
138
|
+
By default, calling .list() returns up to 50 records only.
|
|
139
|
+
```python
|
|
140
|
+
response = client.crm.deal.list()
|
|
141
|
+
deals = response.result # up to 50 records
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The .as_list() method retrieves all records by automatically.
|
|
145
|
+
```python
|
|
146
|
+
response = client.crm.deal.list()
|
|
147
|
+
deals = response.as_list().result # full list of records
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
The .as_list_fast() method is optimized for large datasets.
|
|
151
|
+
It uses a more efficient algorithm and is recommended when receiving many records.
|
|
152
|
+
```python
|
|
153
|
+
response = client.crm.deal.list()
|
|
154
|
+
deals = response.as_list_fast().result # generator
|
|
155
|
+
for deal in deals: # requests are made lazily during iteration
|
|
156
|
+
print(deal)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Library use via abstract classes
|
|
160
|
+
|
|
161
|
+
Instead of BitrixApp and BitrixToken, you can use their abstract class versions with frameworks and ORM libraries.
|
|
162
|
+
When using these abstract classes, the programmer is responsible for declaring the instance attributes and storing them.
|
|
163
|
+
|
|
164
|
+
Examples of the available abstract classes are AbstractBitrixApp, AbstractBitrixAppLocal, AbstractBitrixToken and AbstractBitrixTokenLocal.
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Introduction
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
B24PySDK is the official library for working with the Bitrix24 REST API in Python.
|
|
6
|
+
|
|
7
|
+
It offers following advantages:
|
|
8
|
+
1. Supports authorization via tokens and webhooks;
|
|
9
|
+
2. Allows to pass arguments and retreive response data as native Python types;
|
|
10
|
+
3. Utilizes type hints to show possible method arguments and their types;
|
|
11
|
+
4. Checks that passed arguments have valid types.
|
|
12
|
+
|
|
13
|
+
# Documentation
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
The REST API documentation can be found on [Bitrix24 REST API](https://apidocs.bitrix24.com/).
|
|
18
|
+
|
|
19
|
+
# Quickstart
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
This section provides a short guide to help you get started with B24PySDK.
|
|
24
|
+
|
|
25
|
+
The following examples illustrate common scenarios when using the library.
|
|
26
|
+
## Calling an API method
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
To call Bitrix API, import Client and BitrixWebhook or BitrixToken classes from the library and create class objects.
|
|
31
|
+
There are two ways of calling API methods via library.
|
|
32
|
+
1. Using a permanent incoming local webhook code: https://apidocs.bitrix24.com/local-integrations/local-webhooks.html
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from b24pysdk import BitrixWebhook, Client
|
|
36
|
+
|
|
37
|
+
bitrix_token = BitrixWebhook(domain="your_bitrix_portal", auth_token="key_of_your_webhook")
|
|
38
|
+
client = Client(bitrix_token)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
2. Using a temporary OAuth 2.0 authorization token: https://apidocs.bitrix24.com/api-reference/oauth/index.html
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from b24pysdk import BitrixToken, Client, BitrixApp
|
|
45
|
+
|
|
46
|
+
bitrix_app = BitrixApp(client_id="app_code", client_secret="app_key")
|
|
47
|
+
bitrix_token = BitrixToken(
|
|
48
|
+
domain="your_bitrix_portal",
|
|
49
|
+
auth_token="key_of_your_webhook",
|
|
50
|
+
refresh_token="refresh_token_of_the_app", # optional parameter
|
|
51
|
+
bitrix_app=bitrix_app,
|
|
52
|
+
)
|
|
53
|
+
client = Client(bitrix_token)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Client class is your access point to the API. All supported methods can be called using properties of created instance.
|
|
57
|
+
|
|
58
|
+
For example, to get a description of deal fields we can use REST method crm.deal.fields like so:
|
|
59
|
+
```python
|
|
60
|
+
response = client.crm.deal.fields()
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Passing parameters in API calls
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
Most of Bitrix REST API methods allow you to pass some arguments to them. In order to send them using SDK, simply pass these arguments as positional or named arguments to the corresponding Python function.
|
|
68
|
+
|
|
69
|
+
To illustrate, we can update a deal by calling:
|
|
70
|
+
```python
|
|
71
|
+
response = client.crm.deal.get(bitrix_id=2)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Retrieving results of the call
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
B24PySDK uses deferred method calls. To invoke a method and obtain its result, access the corresponding property.
|
|
79
|
+
The JSON response retrieved from the server is automatically parsed and stored in an object:
|
|
80
|
+
response.result contains the value returned by the API method, while response.time provides the execution time of the request.
|
|
81
|
+
```python
|
|
82
|
+
from b24pysdk import BitrixWebhook, Client
|
|
83
|
+
|
|
84
|
+
bitrix_token = BitrixWebhook(domain="your_bitrix_portal", auth_token="key_of_your_webhook")
|
|
85
|
+
client = Client(bitrix_token)
|
|
86
|
+
|
|
87
|
+
response = client.crm.deal.update(bitrix_id=10, fields={'TITLE': 'New title'})
|
|
88
|
+
print(f'Updated successfully: {response.result}')
|
|
89
|
+
print(f'Call took {response.time.duration} seconds')
|
|
90
|
+
```
|
|
91
|
+
```
|
|
92
|
+
Updated successfully: True
|
|
93
|
+
Call took 0.40396690368652344 seconds
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Retrieving records with list methods
|
|
97
|
+
|
|
98
|
+
For list methods, you can use .as_list() and .as_list_fast() to explicitly retrieve all records.
|
|
99
|
+
> Documentation: https://apidocs.bitrix24.com/api-reference/performance/huge-data.html
|
|
100
|
+
|
|
101
|
+
By default, calling .list() returns up to 50 records only.
|
|
102
|
+
```python
|
|
103
|
+
response = client.crm.deal.list()
|
|
104
|
+
deals = response.result # up to 50 records
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The .as_list() method retrieves all records by automatically.
|
|
108
|
+
```python
|
|
109
|
+
response = client.crm.deal.list()
|
|
110
|
+
deals = response.as_list().result # full list of records
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The .as_list_fast() method is optimized for large datasets.
|
|
114
|
+
It uses a more efficient algorithm and is recommended when receiving many records.
|
|
115
|
+
```python
|
|
116
|
+
response = client.crm.deal.list()
|
|
117
|
+
deals = response.as_list_fast().result # generator
|
|
118
|
+
for deal in deals: # requests are made lazily during iteration
|
|
119
|
+
print(deal)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Library use via abstract classes
|
|
123
|
+
|
|
124
|
+
Instead of BitrixApp and BitrixToken, you can use their abstract class versions with frameworks and ORM libraries.
|
|
125
|
+
When using these abstract classes, the programmer is responsible for declaring the instance attributes and storing them.
|
|
126
|
+
|
|
127
|
+
Examples of the available abstract classes are AbstractBitrixApp, AbstractBitrixAppLocal, AbstractBitrixToken and AbstractBitrixTokenLocal.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from ._client import Client
|
|
2
|
+
from ._config import Config
|
|
3
|
+
from ._version import __title__, __version__
|
|
4
|
+
from .bitrix_api import (
|
|
5
|
+
AbstractBitrixApp,
|
|
6
|
+
AbstractBitrixAppLocal,
|
|
7
|
+
AbstractBitrixToken,
|
|
8
|
+
AbstractBitrixTokenLocal,
|
|
9
|
+
BitrixApp,
|
|
10
|
+
BitrixAppLocal,
|
|
11
|
+
BitrixToken,
|
|
12
|
+
BitrixTokenLocal,
|
|
13
|
+
BitrixWebhook,
|
|
14
|
+
)
|
|
15
|
+
from .version import SDK_VERSION
|
|
16
|
+
|
|
17
|
+
__all__ = [
|
|
18
|
+
"SDK_VERSION",
|
|
19
|
+
"AbstractBitrixApp",
|
|
20
|
+
"AbstractBitrixAppLocal",
|
|
21
|
+
"AbstractBitrixToken",
|
|
22
|
+
"AbstractBitrixTokenLocal",
|
|
23
|
+
"BitrixApp",
|
|
24
|
+
"BitrixAppLocal",
|
|
25
|
+
"BitrixToken",
|
|
26
|
+
"BitrixTokenLocal",
|
|
27
|
+
"BitrixWebhook",
|
|
28
|
+
"Client",
|
|
29
|
+
"Config",
|
|
30
|
+
"__title__",
|
|
31
|
+
"__version__",
|
|
32
|
+
]
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
from typing import Dict, Mapping, Sequence, Union, overload
|
|
2
|
+
|
|
3
|
+
from . import scopes
|
|
4
|
+
from .bitrix_api.bitrix_token import AbstractBitrixToken
|
|
5
|
+
from .bitrix_api.classes import BitrixAPIBatchesRequest, BitrixAPIBatchRequest, BitrixAPIRequest
|
|
6
|
+
from .utils.types import Key, Timeout
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Client:
|
|
10
|
+
""""""
|
|
11
|
+
|
|
12
|
+
__slots__ = (
|
|
13
|
+
"_bitrix_token",
|
|
14
|
+
"_kwargs",
|
|
15
|
+
"crm",
|
|
16
|
+
"department",
|
|
17
|
+
"socialnetwork",
|
|
18
|
+
"user",
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
_bitrix_token: AbstractBitrixToken
|
|
22
|
+
_kwargs: Dict
|
|
23
|
+
crm: scopes.CRM
|
|
24
|
+
department: scopes.Department
|
|
25
|
+
socialnetwork: scopes.Socialnetwork
|
|
26
|
+
user: scopes.User
|
|
27
|
+
|
|
28
|
+
def __init__(
|
|
29
|
+
self,
|
|
30
|
+
bitrix_token: AbstractBitrixToken,
|
|
31
|
+
**kwargs,
|
|
32
|
+
):
|
|
33
|
+
self._bitrix_token = bitrix_token
|
|
34
|
+
self._kwargs = kwargs
|
|
35
|
+
self.crm = scopes.CRM(self)
|
|
36
|
+
self.department = scopes.Department(self)
|
|
37
|
+
self.socialnetwork = scopes.Socialnetwork(self)
|
|
38
|
+
self.user = scopes.User(self)
|
|
39
|
+
|
|
40
|
+
def __str__(self):
|
|
41
|
+
return f"<Client of portal {self._bitrix_token.domain}>"
|
|
42
|
+
|
|
43
|
+
def __repr__(self):
|
|
44
|
+
return f"{self.__class__.__name__}(bitrix_token={self._bitrix_token})"
|
|
45
|
+
|
|
46
|
+
@overload
|
|
47
|
+
def call_batch(
|
|
48
|
+
self,
|
|
49
|
+
bitrix_api_requests: Mapping[Key, BitrixAPIRequest],
|
|
50
|
+
halt: bool = False,
|
|
51
|
+
ignore_size_limit: bool = False,
|
|
52
|
+
timeout: Timeout = None,
|
|
53
|
+
) -> BitrixAPIBatchRequest: ...
|
|
54
|
+
|
|
55
|
+
@overload
|
|
56
|
+
def call_batch(
|
|
57
|
+
self,
|
|
58
|
+
bitrix_api_requests: Sequence[BitrixAPIRequest],
|
|
59
|
+
halt: bool = False,
|
|
60
|
+
ignore_size_limit: bool = False,
|
|
61
|
+
timeout: Timeout = None,
|
|
62
|
+
) -> BitrixAPIBatchRequest: ...
|
|
63
|
+
|
|
64
|
+
def call_batch(
|
|
65
|
+
self,
|
|
66
|
+
bitrix_api_requests: Union[Mapping[Key, BitrixAPIRequest], Sequence[BitrixAPIRequest]],
|
|
67
|
+
halt: bool = False,
|
|
68
|
+
ignore_size_limit: bool = False,
|
|
69
|
+
timeout: Timeout = None,
|
|
70
|
+
) -> BitrixAPIBatchRequest:
|
|
71
|
+
""""""
|
|
72
|
+
return BitrixAPIBatchRequest(
|
|
73
|
+
bitrix_token=self._bitrix_token,
|
|
74
|
+
bitrix_api_requests=bitrix_api_requests,
|
|
75
|
+
halt=halt,
|
|
76
|
+
ignore_size_limit=ignore_size_limit,
|
|
77
|
+
timeout=timeout,
|
|
78
|
+
**self._kwargs,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
@overload
|
|
82
|
+
def call_batches(
|
|
83
|
+
self,
|
|
84
|
+
bitrix_api_requests: Mapping[Key, BitrixAPIRequest],
|
|
85
|
+
halt: bool = False,
|
|
86
|
+
timeout: Timeout = None,
|
|
87
|
+
) -> BitrixAPIBatchRequest: ...
|
|
88
|
+
|
|
89
|
+
@overload
|
|
90
|
+
def call_batches(
|
|
91
|
+
self,
|
|
92
|
+
bitrix_api_requests: Sequence[BitrixAPIRequest],
|
|
93
|
+
halt: bool = False,
|
|
94
|
+
timeout: Timeout = None,
|
|
95
|
+
) -> BitrixAPIBatchRequest: ...
|
|
96
|
+
|
|
97
|
+
def call_batches(
|
|
98
|
+
self,
|
|
99
|
+
bitrix_api_requests: Union[Mapping[Key, BitrixAPIRequest], Sequence[BitrixAPIRequest]],
|
|
100
|
+
halt: bool = False,
|
|
101
|
+
timeout: Timeout = None,
|
|
102
|
+
) -> BitrixAPIBatchesRequest:
|
|
103
|
+
""""""
|
|
104
|
+
return BitrixAPIBatchesRequest(
|
|
105
|
+
bitrix_token=self._bitrix_token,
|
|
106
|
+
bitrix_api_requests=bitrix_api_requests,
|
|
107
|
+
halt=halt,
|
|
108
|
+
timeout=timeout,
|
|
109
|
+
**self._kwargs,
|
|
110
|
+
)
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import threading
|
|
2
|
+
|
|
3
|
+
from ._constants import DEFAULT_TIMEOUT, INITIAL_RETRY_DELAY, MAX_RETRIES, RETRY_DELAY_INCREMENT
|
|
4
|
+
from .utils.types import DefaultTimeout, Number
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class _LocalConfig:
|
|
8
|
+
""""""
|
|
9
|
+
|
|
10
|
+
__slots__ = (
|
|
11
|
+
"default_timeout",
|
|
12
|
+
"initial_retry_delay",
|
|
13
|
+
"max_retries",
|
|
14
|
+
"retry_delay_increment",
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
initial_retry_delay: Number
|
|
18
|
+
default_timeout: DefaultTimeout
|
|
19
|
+
max_retries: int
|
|
20
|
+
retry_delay_increment: Number
|
|
21
|
+
|
|
22
|
+
def __init__(self):
|
|
23
|
+
self.default_timeout: DefaultTimeout = DEFAULT_TIMEOUT
|
|
24
|
+
self.initial_retry_delay: Number = INITIAL_RETRY_DELAY
|
|
25
|
+
self.max_retries: int = MAX_RETRIES
|
|
26
|
+
self.retry_delay_increment: Number = RETRY_DELAY_INCREMENT
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class Config:
|
|
30
|
+
"""Thread-local configuration for SDK behavior"""
|
|
31
|
+
|
|
32
|
+
_local_thread = threading.local()
|
|
33
|
+
|
|
34
|
+
def __init__(self):
|
|
35
|
+
local_thread = type(self)._local_thread
|
|
36
|
+
|
|
37
|
+
if not hasattr(local_thread, "config"):
|
|
38
|
+
local_thread.config = _LocalConfig()
|
|
39
|
+
|
|
40
|
+
self._config = local_thread.config
|
|
41
|
+
|
|
42
|
+
@property
|
|
43
|
+
def default_timeout(self) -> DefaultTimeout:
|
|
44
|
+
"""Default timeout for API calls"""
|
|
45
|
+
return self._config.default_timeout
|
|
46
|
+
|
|
47
|
+
@default_timeout.setter
|
|
48
|
+
def default_timeout(self, value: DefaultTimeout):
|
|
49
|
+
""""""
|
|
50
|
+
|
|
51
|
+
if not (isinstance(value, (int, float)) and value > 0):
|
|
52
|
+
raise ValueError("Default_timeout must be a positive number or a tuple of two positive numbers (connect_timeout, read_timeout)")
|
|
53
|
+
|
|
54
|
+
self._config.default_timeout = value
|
|
55
|
+
|
|
56
|
+
@property
|
|
57
|
+
def max_retries(self) -> int:
|
|
58
|
+
"""Maximum number retries that will occur when server is not responding"""
|
|
59
|
+
return self._config.max_retries
|
|
60
|
+
|
|
61
|
+
@max_retries.setter
|
|
62
|
+
def max_retries(self, value: int):
|
|
63
|
+
""""""
|
|
64
|
+
|
|
65
|
+
if not (isinstance(value, int) and value >= 1):
|
|
66
|
+
raise ValueError("Max_retries must be a positive integer (>= 1)")
|
|
67
|
+
|
|
68
|
+
self._config.max_retries = value
|
|
69
|
+
|
|
70
|
+
@property
|
|
71
|
+
def initial_retry_delay(self) -> Number:
|
|
72
|
+
"""Initial delay between retries in seconds"""
|
|
73
|
+
return self._config.initial_retry_delay
|
|
74
|
+
|
|
75
|
+
@initial_retry_delay.setter
|
|
76
|
+
def initial_retry_delay(self, value: Number):
|
|
77
|
+
""""""
|
|
78
|
+
|
|
79
|
+
if not (isinstance(value, (int, float)) and value > 0):
|
|
80
|
+
raise ValueError("Initial_retry_delay must be a positive number")
|
|
81
|
+
|
|
82
|
+
self._config.initial_retry_delay = value
|
|
83
|
+
|
|
84
|
+
@property
|
|
85
|
+
def retry_delay_increment(self) -> Number:
|
|
86
|
+
"""Amount by which delay between retries will increment after each retry"""
|
|
87
|
+
return self._config.retry_delay_increment
|
|
88
|
+
|
|
89
|
+
@retry_delay_increment.setter
|
|
90
|
+
def retry_delay_increment(self, value: Number):
|
|
91
|
+
""""""
|
|
92
|
+
|
|
93
|
+
if not (isinstance(value, (int, float)) and value >= 0):
|
|
94
|
+
raise ValueError("Retry_delay_increment must be a positive number")
|
|
95
|
+
|
|
96
|
+
self._config.retry_delay_increment = value
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from typing import Final, Tuple
|
|
3
|
+
|
|
4
|
+
from .utils.types import DefaultTimeout, Number
|
|
5
|
+
|
|
6
|
+
PYTHON_VERSION: Final[Tuple] = sys.version_info
|
|
7
|
+
""""""
|
|
8
|
+
|
|
9
|
+
TEXT_PYTHON_VERSION = f"{PYTHON_VERSION[0]}.{PYTHON_VERSION[1]}"
|
|
10
|
+
""""""
|
|
11
|
+
|
|
12
|
+
DEFAULT_TIMEOUT: Final[DefaultTimeout] = 10
|
|
13
|
+
""""""
|
|
14
|
+
|
|
15
|
+
INITIAL_RETRY_DELAY: Final[Number] = 1
|
|
16
|
+
""""""
|
|
17
|
+
|
|
18
|
+
MAX_BATCH_SIZE: Final[int] = 50
|
|
19
|
+
""""""
|
|
20
|
+
|
|
21
|
+
MAX_RETRIES: Final[int] = 3
|
|
22
|
+
""""""
|
|
23
|
+
|
|
24
|
+
RETRY_DELAY_INCREMENT: Final[Number] = 0
|
|
25
|
+
""""""
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from .bitrix_app import AbstractBitrixApp, AbstractBitrixAppLocal, BitrixApp, BitrixAppLocal
|
|
2
|
+
from .bitrix_token import AbstractBitrixToken, AbstractBitrixTokenLocal, BitrixToken, BitrixTokenLocal, BitrixWebhook
|
|
3
|
+
|
|
4
|
+
__all__ = [
|
|
5
|
+
"AbstractBitrixApp",
|
|
6
|
+
"AbstractBitrixAppLocal",
|
|
7
|
+
"AbstractBitrixToken",
|
|
8
|
+
"AbstractBitrixTokenLocal",
|
|
9
|
+
"BitrixApp",
|
|
10
|
+
"BitrixAppLocal",
|
|
11
|
+
"BitrixToken",
|
|
12
|
+
"BitrixTokenLocal",
|
|
13
|
+
"BitrixWebhook",
|
|
14
|
+
]
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import Text
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class AbstractBitrixApp(ABC):
|
|
6
|
+
""""""
|
|
7
|
+
|
|
8
|
+
client_id: Text = NotImplemented
|
|
9
|
+
""""""
|
|
10
|
+
|
|
11
|
+
client_secret: Text = NotImplemented
|
|
12
|
+
""""""
|
|
13
|
+
|
|
14
|
+
@abstractmethod
|
|
15
|
+
def __init__(self, *args, **kwargs):
|
|
16
|
+
""""""
|
|
17
|
+
super().__init__(*args, **kwargs)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class AbstractBitrixAppLocal(AbstractBitrixApp, ABC):
|
|
21
|
+
""""""
|
|
22
|
+
|
|
23
|
+
domain: Text
|
|
24
|
+
""""""
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class BitrixApp(AbstractBitrixApp):
|
|
28
|
+
"""Local or market bitrix application"""
|
|
29
|
+
|
|
30
|
+
def __init__(
|
|
31
|
+
self,
|
|
32
|
+
*,
|
|
33
|
+
client_id: Text,
|
|
34
|
+
client_secret: Text,
|
|
35
|
+
):
|
|
36
|
+
self.client_id = client_id
|
|
37
|
+
self.client_secret = client_secret
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class BitrixAppLocal(AbstractBitrixAppLocal):
|
|
41
|
+
""""""
|
|
42
|
+
|
|
43
|
+
def __init__(
|
|
44
|
+
self,
|
|
45
|
+
*,
|
|
46
|
+
domain: Text,
|
|
47
|
+
client_id: Text,
|
|
48
|
+
client_secret: Text,
|
|
49
|
+
):
|
|
50
|
+
super().__init__(client_id, client_secret)
|
|
51
|
+
self.domian = domain
|