tgshops-integrations 1.1__py3-none-any.whl → 1.2__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.
@@ -110,39 +110,6 @@ class Gateway(NocodbClient):
110
110
  return product.id
111
111
  return None # Return None if no product is found with the given name
112
112
 
113
- async def create_table_column(self, name: str, table_id: Optional[str] = None):
114
-
115
- #TODO needs to be deleted
116
- BEARER_TOKEN = "jpdxJtyfDXdjbvxKAcIij1HA8HGalgalLLXZ46DV"
117
-
118
- headers = {
119
- "Authorization": f"Bearer {BEARER_TOKEN}"
120
- }
121
- if not table_id:
122
- table_id = self.tables_list[self.config.NOCODB_PRODUCTS]
123
-
124
- response = await self.httpx_client.post(
125
- f"{self.NOCODB_HOST.replace('/api/v2', '/api/v1')}/db/meta/tables/{table_id}/columns",
126
- json={
127
- "column_name": name,
128
- "dt": "character varying",
129
- "dtx": "specificType",
130
- "ct": "varchar(45)",
131
- "clen": 45,
132
- "dtxp": "45",
133
- "dtxs": "",
134
- "altered": 1,
135
- "uidt": "SingleLineText",
136
- "uip": "",
137
- "uicn": "",
138
- "title": name
139
- },
140
- headers=headers
141
- )
142
- logger.info(response.text())
143
-
144
- return response.json()
145
-
146
113
  async def delete_all_products(self):
147
114
  items = await self.product_manager.get_products_v2(offset=0,limit=200)
148
115
  products_table = self.tables_list[self.config.NOCODB_PRODUCTS]
@@ -267,10 +267,22 @@ class NocodbClient:
267
267
  files = {'file': (image_name, file, 'image/jpeg')}
268
268
 
269
269
  url = f"{self.NOCODB_HOST.replace('/api/v2', '/api/v1')}/db/storage/upload?path=noco/{source_column_id}/{product_table_name}/{images_column_id}"
270
- timeout = httpx.Timeout(100.0)
271
- response = await self.httpx_client.post(url,files=files,headers=self.httpx_client.headers,timeout=timeout)
272
- if response.status_code == 200:
273
- return response.json()[0]['url']
274
- raise Exception(response.text)
270
+ timeout = httpx.Timeout(200.0)
271
+ try:
272
+ # First attempt
273
+ response = await self.httpx_client.post(url, files=files, headers=self.httpx_client.headers, timeout=timeout)
274
+ if response.status_code == 200:
275
+ return response.json()[0]['url']
276
+
277
+ # If first attempt fails, retry once
278
+ response = await self.httpx_client.post(url, files=files, headers=self.httpx_client.headers, timeout=timeout)
279
+ if response.status_code == 200:
280
+ return response.json()[0]['url']
281
+
282
+ except httpx.HTTPStatusError as e:
283
+ raise Exception(f"HTTP error occurred: {e}")
284
+ except Exception as e:
285
+ raise Exception(f"Request failed: {str(e)}")
286
+
275
287
  else:
276
288
  return ""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tgshops-integrations
3
- Version: 1.1
3
+ Version: 1.2
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=ib7s39K9_VefobHQwtv7ajR3mTDjDziAZd00GBSZ1wA,7391
3
+ tgshops_integrations/middlewares/gateway.py,sha256=TLHASMEJMky-hYTqU5Q2Dh3C4hIjfAN-l6HoP6PzQpQ,6325
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=YfQQ8UAkOonNZKO-oTH36vODu0eE-ElG-Me2bH5LdEM,9072
9
- tgshops_integrations/nocodb_connector/client.py,sha256=MD08P25jYWg0ZoLGk9cZ7cH8WJ6vtMn9oXW1N0LuyZ0,11504
9
+ tgshops_integrations/nocodb_connector/client.py,sha256=FWEWSL5uxZJIIP8gNcfZT3KyBh1CLm9lsAElD93iyCU,12063
10
10
  tgshops_integrations/nocodb_connector/model_mapping.py,sha256=CeGAwEZLK_NlK_eBTtsH6oRsjo6Z-QxWdC9KnwEhtPw,8770
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.1.dist-info/METADATA,sha256=uU8JvqZdrwZETXch9M3YmqvDD_ByhPieCHMTdB1LEpU,2774
14
- tgshops_integrations-1.1.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
15
- tgshops_integrations-1.1.dist-info/top_level.txt,sha256=HFNtxqDpzmlF4ZLnMiwhbU7pOa_YozxU2zBl0bnUmcY,21
16
- tgshops_integrations-1.1.dist-info/RECORD,,
13
+ tgshops_integrations-1.2.dist-info/METADATA,sha256=3PxRU6u73rR4bA2IzvCjKHV5UCEXEA02_J1fOL-46i4,2774
14
+ tgshops_integrations-1.2.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
15
+ tgshops_integrations-1.2.dist-info/top_level.txt,sha256=HFNtxqDpzmlF4ZLnMiwhbU7pOa_YozxU2zBl0bnUmcY,21
16
+ tgshops_integrations-1.2.dist-info/RECORD,,