tgshops-integrations 1.5__py3-none-any.whl → 1.7__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- tgshops_integrations/nocodb_connector/client.py +12 -20
- {tgshops_integrations-1.5.dist-info → tgshops_integrations-1.7.dist-info}/METADATA +1 -1
- {tgshops_integrations-1.5.dist-info → tgshops_integrations-1.7.dist-info}/RECORD +5 -5
- {tgshops_integrations-1.5.dist-info → tgshops_integrations-1.7.dist-info}/WHEEL +0 -0
- {tgshops_integrations-1.5.dist-info → tgshops_integrations-1.7.dist-info}/top_level.txt +0 -0
@@ -253,8 +253,12 @@ class NocodbClient:
|
|
253
253
|
source_column_id -ID of source column
|
254
254
|
linked_record_id - ID of linked record
|
255
255
|
"""
|
256
|
-
|
257
|
-
|
256
|
+
try:
|
257
|
+
response = requests.get(image_url)
|
258
|
+
except:
|
259
|
+
logger.info(f"Error with loading image via url - {image_url}")
|
260
|
+
return ""
|
261
|
+
|
258
262
|
if response.status_code == 200:
|
259
263
|
file = io.BytesIO(response.content)
|
260
264
|
else:
|
@@ -263,26 +267,14 @@ class NocodbClient:
|
|
263
267
|
file_size = file.getbuffer().nbytes
|
264
268
|
|
265
269
|
if file_size:
|
266
|
-
|
267
270
|
files = {'file': (image_name, file, 'image/jpeg')}
|
268
|
-
|
269
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}"
|
270
272
|
timeout = httpx.Timeout(200.0)
|
271
|
-
|
272
|
-
|
273
|
-
response
|
274
|
-
|
275
|
-
|
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
|
-
|
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
|
+
else:
|
277
|
+
logger.info(f"Error with posting image {image_name}, skipping it.")
|
278
|
+
return ""
|
287
279
|
else:
|
288
280
|
return ""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tgshops-integrations
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.7
|
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
|
@@ -6,11 +6,11 @@ tgshops_integrations/models/categories.py,sha256=EG6C8g5dOfXB2MH-vtqH13aqB7_VyOo
|
|
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=
|
9
|
+
tgshops_integrations/nocodb_connector/client.py,sha256=RD8UDS4AXrN1GFmjakZsdTGbP_u2bsoxfopq7UV6MT0,11725
|
10
10
|
tgshops_integrations/nocodb_connector/model_mapping.py,sha256=Sk3AzJCThH97dQIlNuQ7HKqycek_6Tq9UCsWR-9N4_4,8775
|
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.
|
14
|
-
tgshops_integrations-1.
|
15
|
-
tgshops_integrations-1.
|
16
|
-
tgshops_integrations-1.
|
13
|
+
tgshops_integrations-1.7.dist-info/METADATA,sha256=KdFNiKAjgVvKjWnBJ0LLXClL2fFSLhi-ZARzZTQ8DvQ,2774
|
14
|
+
tgshops_integrations-1.7.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
15
|
+
tgshops_integrations-1.7.dist-info/top_level.txt,sha256=HFNtxqDpzmlF4ZLnMiwhbU7pOa_YozxU2zBl0bnUmcY,21
|
16
|
+
tgshops_integrations-1.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|