tgshops-integrations 1.6__py3-none-any.whl → 1.8__py3-none-any.whl

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.
@@ -8,7 +8,7 @@ from tgshops_integrations.nocodb_connector.client import NocodbClient
8
8
 
9
9
  from tgshops_integrations.nocodb_connector.model_mapping import dump_product_data,dump_product_data_with_check, get_pagination_info, ID_FIELD, \
10
10
  parse_product_data, PRODUCT_CATEGORY_ID_LOOKUP_FIELD, PRODUCT_NAME_FIELD, PRODUCT_PRICE_FIELD, \
11
- PRODUCT_STOCK_FIELD
11
+ PRODUCT_STOCK_FIELD,PRODUCT_IMAGES_LOOKUP_FIELD
12
12
 
13
13
  from tgshops_integrations.nocodb_connector.categories import CategoryManager
14
14
  from tgshops_integrations.nocodb_connector.products import ProductManager
@@ -51,7 +51,7 @@ class Gateway(NocodbClient):
51
51
  external_id = data.pop("ID")
52
52
  metadata = await self.get_table_meta(self.tables_list["Products"])
53
53
  images_column=[column["id"] for column in metadata["columns"] if column["column_name"] == "Images"][0]
54
- data["ExternalImages"]=[image['title'] for image in data['Images']]
54
+ data[PRODUCT_IMAGES_LOOKUP_FIELD]=[image['title'] for image in data['Images']]
55
55
 
56
56
  for num,item in enumerate(data['Images']):
57
57
  url_before=item['url']
@@ -269,10 +269,12 @@ class NocodbClient:
269
269
  if file_size:
270
270
  files = {'file': (image_name, file, 'image/jpeg')}
271
271
  url = f"{self.NOCODB_HOST.replace('/api/v2', '/api/v1')}/db/storage/upload?path=noco/{source_column_id}/{product_table_name}/{images_column_id}"
272
- timeout = httpx.Timeout(100.0)
272
+ timeout = httpx.Timeout(200.0)
273
273
  response = await self.httpx_client.post(url,files=files,headers=self.httpx_client.headers,timeout=timeout)
274
274
  if response.status_code == 200:
275
275
  return response.json()[0]['url']
276
- raise Exception(response.text)
276
+ else:
277
+ logger.info(f"Error with posting image {image_name}, skipping it.")
278
+ return ""
277
279
  else:
278
280
  return ""
@@ -53,6 +53,7 @@ def initialize_model_mapping(config_path):
53
53
  PRODUCT_IMAGE_FIELD = config.PRODUCT_IMAGE_FIELD
54
54
  PRODUCT_DISCOUNT_PRICE_FIELD = config.PRODUCT_DISCOUNT_PRICE_FIELD
55
55
  PRODUCT_CATEGORY_ID_LOOKUP_FIELD = config.PRODUCT_CATEGORY_ID_LOOKUP_FIELD
56
+ PRODUCT_IMAGES_LOOKUP_FIELD = config.PRODUCT_IMAGES_LOOKUP_FIELD
56
57
  PRODUCT_REQUIRED_OPTIONS_FIELD = config.PRODUCT_REQUIRED_OPTIONS_FIELD
57
58
  PRODUCT_CATEGORIES_EXTRA_OPTIONS_FIELD = config.PRODUCT_CATEGORIES_EXTRA_OPTIONS_FIELD
58
59
  PRODUCT_CATEGORIES_EXTRA_OPTION_NAMES_FIELD = config.PRODUCT_CATEGORIES_EXTRA_OPTION_NAMES_FIELD
@@ -135,7 +136,7 @@ def dump_product_data_with_check(data: ProductModel, data_check: dict) -> dict:
135
136
  PRODUCT_CURRENCY_FIELD: data.currency,
136
137
  PRODUCT_STOCK_FIELD: data.stock_qty,
137
138
  PRODUCT_CATEGORY_NAME_FIELD:[data.category_name] if data.category_name else None,
138
- PRODUCT_CATEGORY_ID_FIELD: [{'Id': data_check[item]} for item in data.category_name] if data.category_name else None,
139
+ PRODUCT_CATEGORY_ID_FIELD: [{'Id': data_check[item]} for item in data.category_name] if data.category else None,
139
140
  PRODUCT_IMAGE_FIELD: preview_url,
140
141
  PRODUCT_CHECKOUT_MODE: NOCODB_CHECKOUT_MODES,
141
142
  PRODUCT_DISCOUNT_PRICE_FIELD: data.final_price,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tgshops-integrations
3
- Version: 1.6
3
+ Version: 1.8
4
4
  Summary: 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.
5
5
  Home-page: https://git.the-devs.com/virtual-shops/shop-system/shop-backend-integrations/integration-library/integration-library
6
6
  Author: Dimi Latoff
@@ -1,16 +1,16 @@
1
1
  tgshops_integrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  tgshops_integrations/middlewares/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- tgshops_integrations/middlewares/gateway.py,sha256=yyFHGH0MaBk3MMKREe9PxZBmBcFT9MErwavfnmrf1RE,6327
3
+ tgshops_integrations/middlewares/gateway.py,sha256=9IlVtShec1rZ9SEX0rkJgv8IjJFU-lthWAoNAZ4_idg,6366
4
4
  tgshops_integrations/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  tgshops_integrations/models/categories.py,sha256=EG6C8g5dOfXB2MH-vtqH13aqB7_VyOobY2FHpDb-fsY,977
6
6
  tgshops_integrations/models/products.py,sha256=i0vP_eJMVCB-W25BCoodIB0AhsMTqYiDO48N-B6Ueo0,1379
7
7
  tgshops_integrations/nocodb_connector/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  tgshops_integrations/nocodb_connector/categories.py,sha256=x9mtXYEEIt6jV1Qzh_hYwKYJjqyuWyopmyeV0V4myUQ,9069
9
- tgshops_integrations/nocodb_connector/client.py,sha256=qHv14rwad3P9SCH6h3Rj9UhOMGU6qq39jFJX_Ylxb3I,11640
10
- tgshops_integrations/nocodb_connector/model_mapping.py,sha256=Sk3AzJCThH97dQIlNuQ7HKqycek_6Tq9UCsWR-9N4_4,8775
9
+ tgshops_integrations/nocodb_connector/client.py,sha256=RD8UDS4AXrN1GFmjakZsdTGbP_u2bsoxfopq7UV6MT0,11725
10
+ tgshops_integrations/nocodb_connector/model_mapping.py,sha256=VofPj6JtXKsv3-2qgb0FGMu3zZs3xuxe8LCbZtOnCQo,8839
11
11
  tgshops_integrations/nocodb_connector/products.py,sha256=23uXnmznJN6fZw3tZ3a7dJg06LkI2QaNfVhSKochPn4,8677
12
12
  tgshops_integrations/nocodb_connector/tables.py,sha256=ha_QXZXd93mht0fR5E1nM0wUpz1ePon-pIdO2HI67l8,356
13
- tgshops_integrations-1.6.dist-info/METADATA,sha256=LTzbKnfZ99RXRkxr8ydi0Arl5-UEXIyAvJS5LzMplD4,2774
14
- tgshops_integrations-1.6.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
15
- tgshops_integrations-1.6.dist-info/top_level.txt,sha256=HFNtxqDpzmlF4ZLnMiwhbU7pOa_YozxU2zBl0bnUmcY,21
16
- tgshops_integrations-1.6.dist-info/RECORD,,
13
+ tgshops_integrations-1.8.dist-info/METADATA,sha256=76WQYaaqRKXREdqIYP0TiLqMU7d7XnXzw1hz06IjYsE,2774
14
+ tgshops_integrations-1.8.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
15
+ tgshops_integrations-1.8.dist-info/top_level.txt,sha256=HFNtxqDpzmlF4ZLnMiwhbU7pOa_YozxU2zBl0bnUmcY,21
16
+ tgshops_integrations-1.8.dist-info/RECORD,,