Library is intended to provide the integration of the external service or CRM system with the TelegramShops/It allows to configure the relationship between NocoDB list of the products used further to display in the shop/As a resultss the products can be synchronized and updated uppon the request.
Project description
from typing import List
import asyncio
from config import NocoDBConfig
from tgshops_integrations.middlewares.gateway import Gateway
from services.bitrix.client import BitrixClient
# Your credentials are here and source of the target table
NOCODB_HOST = NocoDBConfig.HOST
NOCODB_API_KEY = NocoDBConfig.API_KEY
SOURCE=NocoDBConfig.source_table
async def main():
# Here is your client to upload data from your service
bitrixService=BitrixClient()
# Products have to be in a according to the ProductModel
# class ProductModel(BaseModel):
# id: Optional[str]
# external_id: Optional[str]
# category: Optional[List[str]]
# category_name: Optional[List[str]]
# name: str
# description: Optional[str]
# price: Optional[float]
# final_price: Optional[float]
# currency: Optional[str]
# stock_qty: int
# orders_qty: int = Field(0, hidden_field=True)
# created: datetime = Field(default=datetime.now, hidden_field=True)
# updated: datetime = Field(default=datetime.now, hidden_field=True)
# preview_url: List[str] = []
# extra_attributes: List[ExtraAttribute] = []
bitrix_product_list=await bitrixService.get_crm_product_list()
NocoGateway = Gateway(NOCODB_HOST=NOCODB_HOST,NOCODB_API_KEY=NOCODB_API_KEY)
# Example how to clean your table
# await NocoGateway.load_data(SOURCE=SOURCE)
# await NocoGateway.delete_all_products()
# In order to obtain data from the table need to call load data, to obtain it for further comparation
await NocoGateway.load_data(SOURCE=SOURCE)
# Initializes any missing categories
await NocoGateway.category_manager.update_categories(external_products=bitrix_product_list)
# Creates or updates the products
await NocoGateway.update_products(external_products=bitrix_product_list)
asyncio.run(main())
# python3 setup.py sdist bdist_wheel
# twine upload dist/* --verbose
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tgshops_integrations-3.6.tar.gz.
File metadata
- Download URL: tgshops_integrations-3.6.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56ba4bf38d07543217358c28b12f7022765b3859d124c55887d43b232b862339
|
|
| MD5 |
0ca6792017f7cb06155f016648304d35
|
|
| BLAKE2b-256 |
ad8345d9eac461f5c37e397e5a8b89612b2ede8e8250ed570e8707c35a7ebcfe
|
File details
Details for the file tgshops_integrations-3.6-py3-none-any.whl.
File metadata
- Download URL: tgshops_integrations-3.6-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0195aee5eb54cfc0cf429c2aeaccf0e1403323fe46c2f6ca9582eb10c1d63ae2
|
|
| MD5 |
b6444488418fa171c501cab2f63cb65f
|
|
| BLAKE2b-256 |
9a23287782eb845755aa92358550ab6fd8ddf48ff3157ee3796bf758ff550cab
|