Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot Not Sending Messages to Telegram Channel #11

Open
peppees opened this issue Nov 4, 2024 · 20 comments
Open

Bot Not Sending Messages to Telegram Channel #11

peppees opened this issue Nov 4, 2024 · 20 comments

Comments

@peppees
Copy link

peppees commented Nov 4, 2024

Dear pietro24,

First of all, I want to thank you for the great work you’ve done with this bot. I am experiencing an issue where the bot successfully finds offers but does not send any messages to my Telegram channel. I have double-checked the api_keys.py file, and I am confident that all the information is correctly entered.

I have also configured everything else according to the instructions provided in the documentation. Here are some relevant logs that show the bot is finding products:

2024-11-04 12:14:55 :: [amz_paapi_sdk.py ] - [search_items_by_kw ] - [DEBUG ] - Products Found (8/8): ['B0CC6VCWPM', 'B0B7VK4B8G', 'B01GFLS126', 'B0D8K2S371', 'B01NABATXX', 'B0DK37FN1D', 'B0DGZDSFYD', 'B08741W5LW']
2024-11-04 12:19:50 :: [activity_inspector.py ] - [run_server ] - [INFO ] - Start the server...
2024-11-04 12:19:50 :: [activity_inspector.py ] - [run_server ] - [INFO ] - The server is running at localhost:8000.
2024-11-04 12:19:50 :: [list_manager.py ] - [sub_of_raw_products ] - [DEBUG ] - Total number of category selected: 10
2024-11-04 12:19:52 :: [amz_paapi_sdk.py ] - [search_items_by_kw ] - [INFO ] - API called Successfully. Category: Handmade - Keyword: Decorazioni fatte a mano - Page: 1 - Min Saving Percent: Deactivated
2024-11-04 12:19:52 :: [amz_paapi_sdk.py ] - [search_items_by_kw ] - [DEBUG ] - Products Found (8/8): ['B08C5K1N6Y', 'B01N6RU2IF', 'B0927TKWBD', 'B0C4Z53R5N', 'B08PDTXV3N', 'B0CYH8HBX3', 'B06XN61S8K', 'B08PQ374XS']
2024-11-04 12:19:56 :: [amz_paapi_sdk.py ] - [search_items_by_kw ] - [INFO ] - API called Successfully. Category: Handmade - Keyword: Decorazioni fatte a mano - Page: 2 - Min Saving Percent: Activated
2024-11-04 12:19:56 :: [amz_paapi_sdk.py ] - [search_items_by_kw ] - [DEBUG ] - Products Found (8/8): ['B07GB5V7N3', 'B07MJHL1TJ', 'B091SYJ1VV', 'B07D2JN5YQ', 'B07C5N5V73', 'B0BHL53NX9', 'B08JZKHCPG', 'B08LNM95TH']
2024-11-04 12:20:00 :: [amz_paapi_sdk.py ] - [search_items_by_kw ] - [INFO ] - API called Successfully. Category: Handmade - Keyword: Decorazioni fatte a mano - Page: 3 - Min Saving Percent: Deactivated
2024-11-04 12:20:00 :: [amz_paapi_sdk.py ] - [search_items_by_kw ] - [DEBUG ] - Products Found (8/8): ['B06XD89S81', 'B0BX4VR7YL', 'B0C5Y94FFF', 'B06XDCDKCZ', 'B06XCST3F1', 'B08PDTT97Y', 'B075V49VSB', 'B06XDBG6PK']
2024-11-04 12:20:03 :: [amz_paapi_sdk.py ] - [search_items_by_kw ] - [INFO ] - API called Successfully. Category: Handmade - Keyword: Accessori artigianali - Page: 1 - Min Saving Percent: Deactivated
2024-11-04 12:20:03 :: [amz_paapi_sdk.py ] - [search_items_by_kw ] - [DEBUG ] - Products Found (8/8): ['B09G6LQ8P7', 'B0CVDPY9Q2', 'B0DLRGKFQD', 'B0CYT7RWH2', 'B07CKWMZVS', 'B06XN61S8K', 'B075PNPLR2', 'B0BLCZZRTD']
2024-11-04 12:20:07 :: [amz_paapi_sdk.py ] - [search_items_by_kw ] - [INFO ] - API called Successfully. Category: Handmade - Keyword: Accessori artigianali - Page: 2 - Min Saving Percent: Deactivated
2024-11-04 12:20:07 :: [amz_paapi_sdk.py ] - [search_items_by_kw ] - [DEBUG ] - Products Found (8/8): ['B0BLHJ4KTN', 'B0BL1X5LLD', 'B09BR9JVB2', 'B0BTTNFW42', 'B0DGV5Z8LW', 'B0924PZ2GL', 'B0BXQLJGJ8', 'B08L57M6GF']
2024-11-04 12:20:11 :: [amz_paapi_sdk.py ] - [search_items_by_kw ] - [INFO ] - API called Successfully. Category: Handmade - Keyword: Accessori artigianali - Page: 3 - Min Saving Percent: Deactivated
2024-11-04 12:20:11 :: [amz_paapi_sdk.py ] - [search_items_by_kw ] - [DEBUG ] - Products Found (8/8): ['B0BSLHFRXJ', 'B08L84ZCZF', 'B08L88D5C9', 'B08KTQYPLG', 'B0859ZM7PQ', 'B08KSDJTWJ', 'B08LQ9FZK3', 'B08KT8FSG4']
2024-11-04 12:20:15 :: [amz_paapi_sdk.py ] - [search_items_by_kw ] - [INFO ] - API called Successfully. Category: Fashion - Keyword: Orologi - Page: 1 - Min Saving Percent: Deactivated
2024-11-04 12:20:15 :: [amz_paapi_sdk.py ] - [search_items_by_kw ] - [DEBUG ] - Products Found (8/8): ['B000J34HN4', 'B0C2TF41Z2', 'B0CG1BDQ8B', 'B000GAYQJ0', 'B09W9867V2', 'B076MTPDX6', 'B07SY73Y91', 'B0BRP4LVN2']

I would appreciate any assistance in resolving this issue. Thank you!

@Piero24
Copy link
Owner

Piero24 commented Nov 4, 2024

Hi @peppees, from the log you provided, I don’t see any errors. It only shows that the product search is working fine. Could you please attach the entire log file?

  • Are you sure the telegram API Is correct?
  • Have you added the bot to the channel?

@peppees
Copy link
Author

peppees commented Nov 4, 2024

Hi,

The log does not show any errors; it only includes the details I previously shared regarding the successful product searches.

I am sure that the Telegram API is correct, and I have added the bot to the channel, granting it all necessary administrator permissions.

Please let me know if you need any further information.
11.log

@Piero24
Copy link
Owner

Piero24 commented Nov 4, 2024

This is very strange. Did you use Docker or Python’s venv to start it? I would need the steps to reproduce it… Could you send me all the files so that I can test it before my API key expires? Make sure to remove your Amazon API and the Telegram BOT API key.

@peppees
Copy link
Author

peppees commented Nov 4, 2024

I use python's venv to start it. Anyway would it be possible to send you the files on another platform? They’re quite lengthy, and I'd prefer not to send them here. If we manage to resolve the issue, you could post the solution here if you prefer, to help others as well.

@Piero24
Copy link
Owner

Piero24 commented Nov 4, 2024

Sure, Upload the file on Google Drive or WeTransfer and send me the link here

@peppees
Copy link
Author

peppees commented Nov 5, 2024

Hi! Sorry for the delay, i’ve sent the files via a Google Drive link, as you requested on your website link. Thank you very much

@Piero24
Copy link
Owner

Piero24 commented Nov 6, 2024

Are you sure you haven't changed something in one of the other files? Because with the fils that you have send all works correctly...

Here an eample of the logs... (Note that it needs some time, like a couple of seconds because it has to process products from more pages)

2024-11-06 20:23:04 :: [activity_inspector.py    ] - [run_server             ] - [INFO    ] - Start the server...
2024-11-06 20:23:05 :: [activity_inspector.py    ] - [run_server             ] - [INFO    ] - The server is running at localhost:8000.
2024-11-06 20:23:05 :: [list_manager.py          ] - [sub_of_raw_products    ] - [DEBUG   ] - Total number of category selected: 8
2024-11-06 20:23:07 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: HomeAndKitchen - Keyword: Tavola - Page: 1 - Min Saving Percent: Activated
2024-11-06 20:23:07 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B00CLCRHDS', 'B00DW3VAYM', 'B07HSDBQXS', 'B01MYEYHE2', 'B00A6FJPL4', 'B0002DFDNE', 'B004X9NAI8', 'B06X43TTBD']
2024-11-06 20:23:10 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: HomeAndKitchen - Keyword: Tavola - Page: 2 - Min Saving Percent: Deactivated
2024-11-06 20:23:10 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B0D9KMP5QJ', 'B013I7CUCC', 'B09KCL1ZJ4', 'B079KMV2G4', 'B09MHNLYF1', 'B0BYPZ197C', 'B08M972GJL', 'B0822FLX45']
2024-11-06 20:23:13 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: HomeAndKitchen - Keyword: Tavola - Page: 3 - Min Saving Percent: Deactivated
2024-11-06 20:23:13 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B07HSDBQXS', 'B0CX2W3HQB', 'B0859YNNSL', 'B0CRVPRW1Y', 'B085CDB6WX', 'B082P3J1Y2', 'B08T71MH4C', 'B08LYFCMYD']
2024-11-06 20:23:16 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: HomeAndKitchen - Keyword: Arredamento - Page: 1 - Min Saving Percent: Deactivated
2024-11-06 20:23:16 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B07PHCGZVF', 'B0CJDSQNFW', 'B009VD1FSI', 'B0BZVTTC8D', 'B08NX5PD3K', 'B08G548Z1W', 'B01AC217LQ', 'B0BTPDPZGS']
2024-11-06 20:23:19 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: HomeAndKitchen - Keyword: Arredamento - Page: 2 - Min Saving Percent: Deactivated
2024-11-06 20:23:19 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B0CJM89942', 'B0CQFW3M3V', 'B0B29HDNWP', 'B0BLC1CPSL', 'B07T31R5F4', 'B09ZJ5W4F1', 'B0BMWV73TG', 'B0CPV7SH4B']
2024-11-06 20:23:22 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: HomeAndKitchen - Keyword: Arredamento - Page: 3 - Min Saving Percent: Deactivated
2024-11-06 20:23:22 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B08B3SS4Q4', 'B0BXD93VZ3', 'B09GGCJ9T4', 'B07XPG57CW', 'B08ZJC3WBK', 'B09BCKG9CJ', 'B0C7PVSY8R', 'B07TXQ49RZ']
2024-11-06 20:23:25 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Fashion - Keyword: Valigeria - Page: 1 - Min Saving Percent: Deactivated
2024-11-06 20:23:25 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B07RWCSBLR', 'B0BVQ5518V', 'B071VG5N9D', 'B079LZ4GL7', 'B01LYQ5WFE', 'B08RN455Y2', 'B0BNJGZYGS', 'B083LTNMJB']
2024-11-06 20:23:29 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Fashion - Keyword: Valigeria - Page: 2 - Min Saving Percent: Activated
2024-11-06 20:23:29 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B0BRM4JNSF', 'B0CLNZKGM2', 'B0C5R9F39H', 'B0C3WQQRD2', 'B07DP3JGDK', 'B00TSP4STM', 'B0C5RB2GGH', 'B0CGMBKLWF']
2024-11-06 20:23:32 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Fashion - Keyword: Valigeria - Page: 3 - Min Saving Percent: Deactivated
2024-11-06 20:23:32 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B0771KH8FL', 'B07DFDLYLN', 'B0CFTC8R55', 'B07K47BG6K', 'B0CHJPL4RB', 'B0BJBVZ184', 'B07895XQPH', 'B0DBLT2F6Y']
2024-11-06 20:23:35 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Handmade - Keyword: Decorazioni fatte a mano - Page: 1 - Min Saving Percent: Activated
2024-11-06 20:23:35 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B07ZNZ486T', 'B099WYRK8D', 'B08VTPWFWC', 'B0CT8T19BK', 'B01M0W0G5K', 'B0CLP3RNQX', 'B088SMMWCX', 'B07GB5V7N3']
2024-11-06 20:23:39 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Handmade - Keyword: Decorazioni fatte a mano - Page: 2 - Min Saving Percent: Deactivated
2024-11-06 20:23:39 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B08PQ374XS', 'B06XDN5KB8', 'B083V6N97F', 'B07XXFVPBS', 'B08PDTT97Y', 'B0C5Y94FFF', 'B08Y826GGK', 'B074DTVQL4']
2024-11-06 20:23:42 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Handmade - Keyword: Decorazioni fatte a mano - Page: 3 - Min Saving Percent: Activated
2024-11-06 20:23:42 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B0BHJM64Z3', 'B0BHJMDYKY', 'B07D2JN5YQ', 'B086PSXRHH', 'B08JZH4RX1', 'B086PX4S77', 'B08TPCP1CJ', 'B08TP7PF5J']
2024-11-06 20:23:45 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Handmade - Keyword: Decorazioni fatte a mano - Page: 1 - Min Saving Percent: Activated
2024-11-06 20:23:45 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B07ZNZ486T', 'B099WYRK8D', 'B08VTPWFWC', 'B0CT8T19BK', 'B01M0W0G5K', 'B0CLP3RNQX', 'B088SMMWCX', 'B07GB5V7N3']
2024-11-06 20:23:48 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Handmade - Keyword: Decorazioni fatte a mano - Page: 2 - Min Saving Percent: Deactivated
2024-11-06 20:23:48 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B08PQ374XS', 'B06XDN5KB8', 'B083V6N97F', 'B07XXFVPBS', 'B08PDTT97Y', 'B0C5Y94FFF', 'B08Y826GGK', 'B074DTVQL4']
2024-11-06 20:23:51 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Handmade - Keyword: Decorazioni fatte a mano - Page: 3 - Min Saving Percent: Deactivated
2024-11-06 20:23:51 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B07ZNZ486T', 'B06XDCDKCZ', 'B06XCST3F1', 'B0BX4V292G', 'B0BX4VR7YL', 'B075V49VSB', 'B06XDBG6PK', 'B076HV496D']
2024-11-06 20:23:54 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: DigitalMusic - Keyword: CD - Page: 1 - Min Saving Percent: Deactivated
2024-11-06 20:23:54 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B009LOR2RA', 'B00AHE1BLQ', 'B009IITNR6', 'B0DGV9S6VP', 'B008LVXZ1G', 'B0D7J2SH6F', 'B0DBVZ7N4N', 'B0C76BCK1R']
2024-11-06 20:23:57 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: DigitalMusic - Keyword: CD - Page: 2 - Min Saving Percent: Deactivated
2024-11-06 20:23:57 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B009ILFXIQ', 'B009EAY698', 'B0BVDRNN2F', 'B0BD63G9T5', 'B0C2RVBC94', 'B009HT53PM', 'B0DB2Z753P', 'B0BNLKNKKB']
2024-11-06 20:24:00 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: DigitalMusic - Keyword: CD - Page: 3 - Min Saving Percent: Deactivated
2024-11-06 20:24:00 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B0093ZA1DE', 'B07N7983XB', 'B0DJD5ZMGG', 'B0DD87F1RL', 'B0DJ3TD6N1', 'B009F54QCO', 'B009EHZNDO', 'B0DD8GN953']
2024-11-06 20:24:03 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: DigitalMusic - Keyword: Singoli - Page: 1 - Min Saving Percent: Deactivated
2024-11-06 20:24:03 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B07MX9VSP3', 'B08QZWTK15', 'B07MCV813V', 'B0D4ZKN5SB', 'B008SZLTP4', 'B08JS9NHRG', 'B00S7C6C28', 'B07MX3LGSV']
2024-11-06 20:24:06 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: DigitalMusic - Keyword: Singoli - Page: 2 - Min Saving Percent: Deactivated
2024-11-06 20:24:06 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B01ALQ7D2K', 'B0D7ZHG19W', 'B008T9HBHE', 'B08KSKNVV1', 'B07MG8NG6S', 'B07D9LZBLV', 'B0B7K88QCV', 'B0DJGRW2HS']
2024-11-06 20:24:09 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: DigitalMusic - Keyword: Singoli - Page: 3 - Min Saving Percent: Deactivated
2024-11-06 20:24:09 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B0CHJDKV74', 'B07B4XY2NR', 'B0D873TXBY', 'B07HYJMVR7', 'B075QN95D5', 'B0DC4C8Y7M', 'B009IBIVN0', 'B0DK2CW24W']
2024-11-06 20:24:12 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: DigitalMusic - Keyword: CD - Page: 1 - Min Saving Percent: Deactivated
2024-11-06 20:24:12 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B009LOR2RA', 'B00AHE1BLQ', 'B009IITNR6', 'B0DGV9S6VP', 'B008LVXZ1G', 'B0D7J2SH6F', 'B0DBVZ7N4N', 'B0C76BCK1R']
2024-11-06 20:24:15 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: DigitalMusic - Keyword: CD - Page: 2 - Min Saving Percent: Deactivated
2024-11-06 20:24:15 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B009ILFXIQ', 'B009EAY698', 'B0BVDRNN2F', 'B0BD63G9T5', 'B0C2RVBC94', 'B009HT53PM', 'B0DB2Z753P', 'B0BNLKNKKB']
2024-11-06 20:24:17 :: [list_manager.py          ] - [extraction_raw_products] - [ERROR   ] - None Response from the PA-API 5.0 for the keyword: CD on category: DigitalMusic
2024-11-06 20:24:29 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: GroceryAndGourmetFood - Keyword: Alcolici - Page: 1 - Min Saving Percent: Activated
2024-11-06 20:24:29 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B003VGSZD4', 'B009YESDXE', 'B0089E2OJE', 'B074Z72STD', 'B00HCI6DJ0', 'B001TZ5KRI', 'B01M0XCDOJ', 'B00GY3I2B6']
2024-11-06 20:24:32 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: GroceryAndGourmetFood - Keyword: Alcolici - Page: 2 - Min Saving Percent: Deactivated
2024-11-06 20:24:32 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B0012Z5L7O', 'B0043A0094', 'B074Z72STD', 'B009UWC976', 'B00XUSB4YK', 'B000TVHK26', 'B0058NYI66', 'B009ZXZW7E']
2024-11-06 20:24:36 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: GroceryAndGourmetFood - Keyword: Alcolici - Page: 3 - Min Saving Percent: Activated
2024-11-06 20:24:36 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B002E2QJG6', 'B002EPBL1Q', 'B08VY28PZV', 'B09TTN7HTT', 'B003TJM57K', 'B08LHTNMD3', 'B07DGHQPZ8', 'B004AKLKSM']
2024-11-06 20:24:39 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Beauty - Keyword: Cosmetici - Page: 1 - Min Saving Percent: Deactivated
2024-11-06 20:24:39 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B09NYN3YYN', 'B0CC1J8GN8', 'B0038E8OOO', 'B08RC5J1TT', 'B08P3C5Y99', 'B0DFQK9VKK', 'B09B7DQ5MY', 'B07M91H7XB']
2024-11-06 20:24:43 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Beauty - Keyword: Cosmetici - Page: 2 - Min Saving Percent: Deactivated
2024-11-06 20:24:43 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B0B6GFJNNL', 'B0CNCKRVNJ', 'B0BKZW9RGB', 'B09TRG9YSW', 'B07TXV26WD', 'B08NX1JN9W', 'B08RC68QHN', 'B00ID51030']
2024-11-06 20:24:46 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Beauty - Keyword: Cosmetici - Page: 3 - Min Saving Percent: Deactivated
2024-11-06 20:24:46 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B00YBYMQN0', 'B0C89NQMKR', 'B0B6GCJWZX', 'B079R3P5JH', 'B0CGRBLDC5', 'B0CFF73ZMZ', 'B08HRKDK95', 'B08HRLTZBV']
2024-11-06 20:24:50 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Beauty - Keyword: Trucchi per occhi - Page: 1 - Min Saving Percent: Deactivated
2024-11-06 20:24:50 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B0742CVQW4', 'B00BTEVMDA', 'B001KYTULU', 'B09NQD7Z65', 'B003RSMP50', 'B004LXJQPM', 'B0BNZDQQV3', 'B08KZH7NP5']
2024-11-06 20:24:53 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Beauty - Keyword: Trucchi per occhi - Page: 2 - Min Saving Percent: Activated
2024-11-06 20:24:53 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B0979NC4D6', 'B00XQB8MJQ', 'B07WP9R2ZV', 'B0D927Z2NP', 'B0CFZW5XY8', 'B07KGT94LB', 'B09TF8HF3X', 'B097BG6QB2']
2024-11-06 20:24:56 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Beauty - Keyword: Trucchi per occhi - Page: 3 - Min Saving Percent: Activated
2024-11-06 20:24:56 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B09TPF9RL1', 'B00M6TJVQM', 'B0799RHQHJ', 'B0CLGHVCV5', 'B0CBPTK6J6', 'B0CDLGL7PS', 'B07MKQYMYW', 'B0CFL1LGHQ']
2024-11-06 20:25:00 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Beauty - Keyword: Cosmetici - Page: 1 - Min Saving Percent: Deactivated
2024-11-06 20:25:00 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B09NYN3YYN', 'B0CC1J8GN8', 'B0038E8OOO', 'B08RC5J1TT', 'B08P3C5Y99', 'B0DFQK9VKK', 'B09B7DQ5MY', 'B07M91H7XB']
2024-11-06 20:25:03 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Beauty - Keyword: Cosmetici - Page: 2 - Min Saving Percent: Deactivated
2024-11-06 20:25:03 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B0B6GFJNNL', 'B0CNCKRVNJ', 'B0BKZW9RGB', 'B09TRG9YSW', 'B07TXV26WD', 'B08NX1JN9W', 'B08RC68QHN', 'B00ID51030']
2024-11-06 20:25:06 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Beauty - Keyword: Cosmetici - Page: 3 - Min Saving Percent: Deactivated
2024-11-06 20:25:06 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B00YBYMQN0', 'B0C89NQMKR', 'B0B6GCJWZX', 'B079R3P5JH', 'B0CGRBLDC5', 'B0CFF73ZMZ', 'B08HRKDK95', 'B08HRLTZBV']
2024-11-06 20:25:09 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Electronics - Keyword: Smartphone - Page: 1 - Min Saving Percent: Activated
2024-11-06 20:25:09 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B0CRRSDZ5R', 'B0D5RDYHSZ', 'B0CN13F65C', 'B0C6FDCPB1', 'B09QH71RZR', 'B0D81J2KFN', 'B0CRF5VT83', 'B0CN12BMRW']
2024-11-06 20:25:12 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Electronics - Keyword: Smartphone - Page: 2 - Min Saving Percent: Activated
2024-11-06 20:25:12 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B0CP18P9W7', 'B0CRF77622', 'B0CV4KL9HC', 'B0D4R89TZV', 'B0CBL2XCNN', 'B0CKLT46MV', 'B0D2KNZKHK', 'B0DCJW5LBQ']
2024-11-06 20:25:16 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Electronics - Keyword: Smartphone - Page: 3 - Min Saving Percent: Activated
2024-11-06 20:25:16 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B0CYGN1JX2', 'B0CQYWG2T8', 'B0DBVDRNK5', 'B0DCBKB7TQ', 'B0CNHCL7MK', 'B0CPHN7K43', 'B0CXJ9XSVZ', 'B0BWS8N8P7']
2024-11-06 20:25:19 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Electronics - Keyword: Cuffie - Page: 1 - Min Saving Percent: Activated
2024-11-06 20:25:19 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B01MG62Z5M', 'B00NBR70DO', 'B08VD6SRBZ', 'B07HGTXF95', 'B08DYCRFJ6', 'B0CHLYB4Z3', 'B0BTJD6LCL', 'B0BSNQVWD9']
2024-11-06 20:25:23 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Electronics - Keyword: Cuffie - Page: 2 - Min Saving Percent: Deactivated
2024-11-06 20:25:23 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B0BTJD6LCL', 'B07N1D9MZD', 'B09PFYS1ZZ', 'B0BSNQVWD9', 'B0C94KNS8D', 'B00ZLTBXSS', 'B0D1489BZ8', 'B00NBR6RDS']
2024-11-06 20:25:26 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: Electronics - Keyword: Cuffie - Page: 3 - Min Saving Percent: Deactivated
2024-11-06 20:25:26 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B00009LHI7', 'B0763L841F', 'B00I3LV1HE', 'B0DK53BTX6', 'B0CG1Q168Y', 'B0DBLNQS6R', 'B0D5D1C2P8', 'B00OD74Q2Y']
2024-11-06 20:25:29 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: OfficeProducts - Keyword: Sedie per ufficio - Page: 1 - Min Saving Percent: Deactivated
2024-11-06 20:25:29 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B0C2HQB3SX', 'B082PWGGMD', 'B07XRSS7LJ', 'B07XRHBXM7', 'B005M23SPK', 'B0CZMRTF59', 'B0963DLXJZ', 'B0CNQ94C25']
2024-11-06 20:25:33 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: OfficeProducts - Keyword: Sedie per ufficio - Page: 2 - Min Saving Percent: Deactivated
2024-11-06 20:25:33 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B076X3XFN4', 'B00UTBFWNU', 'B08CB31YL9', 'B07ZCM9YH1', 'B0CJMC6ZLR', 'B0D4F4R48Y', 'B0DCK4PYYH', 'B0C3BZHVK8']
2024-11-06 20:25:36 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: OfficeProducts - Keyword: Sedie per ufficio - Page: 3 - Min Saving Percent: Deactivated
2024-11-06 20:25:36 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B0DCJPW6J7', 'B0CJ9PXCWM', 'B07BYY5XJL', 'B077MYVDQY', 'B0C8B8M1Z5', 'B09J2HQJLS', 'B0BV2TTH6J', 'B08MPTY6R1']
2024-11-06 20:25:39 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: OfficeProducts - Keyword: Sedie per ufficio - Page: 1 - Min Saving Percent: Deactivated
2024-11-06 20:25:39 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B0C2HQB3SX', 'B082PWGGMD', 'B07XRSS7LJ', 'B07XRHBXM7', 'B005M23SPK', 'B0CZMRTF59', 'B0963DLXJZ', 'B0CNQ94C25']
2024-11-06 20:25:42 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: OfficeProducts - Keyword: Sedie per ufficio - Page: 2 - Min Saving Percent: Deactivated
2024-11-06 20:25:42 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B076X3XFN4', 'B00UTBFWNU', 'B08CB31YL9', 'B07ZCM9YH1', 'B0CJMC6ZLR', 'B0D4F4R48Y', 'B0DCK4PYYH', 'B0C3BZHVK8']
2024-11-06 20:25:46 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [INFO    ] - API called Successfully. Category: OfficeProducts - Keyword: Sedie per ufficio - Page: 3 - Min Saving Percent: Deactivated
2024-11-06 20:25:46 :: [amz_paapi_sdk.py         ] - [search_items_by_kw     ] - [DEBUG   ] - Products Found (8/8): ['B0DCJPW6J7', 'B0CJ9PXCWM', 'B07BYY5XJL', 'B077MYVDQY', 'B0C8B8M1Z5', 'B09J2HQJLS', 'B0BV2TTH6J', 'B08MPTY6R1']
2024-11-06 20:25:48 :: [list_manager.py          ] - [print_no_discount      ] - [WARNING ] - No discount found for he asins: ['B004X9NAI8', 'B0D9KMP5QJ', 'B013I7CUCC', 'B079KMV2G4', 'B09MHNLYF1', 'B0BYPZ197C', 'B0822FLX45', 'B0CX2W3HQB', 'B0CRVPRW1Y', 'B085CDB6WX']
2024-11-06 20:25:48 :: [list_manager.py          ] - [print_no_discount      ] - [WARNING ] - No discount found for he asins: ['B082P3J1Y2', 'B08T71MH4C', 'B08LYFCMYD', 'B0CJDSQNFW', 'B0BZVTTC8D', 'B08NX5PD3K', 'B08G548Z1W', 'B01AC217LQ', 'B0BTPDPZGS', 'B0CJM89942']
2024-11-06 20:25:48 :: [list_manager.py          ] - [print_no_discount      ] - [WARNING ] - No discount found for he asins: ['B0CQFW3M3V', 'B0B29HDNWP', 'B09ZJ5W4F1', 'B0BMWV73TG', 'B0CPV7SH4B', 'B0BXD93VZ3', 'B09GGCJ9T4', 'B08ZJC3WBK', 'B09BCKG9CJ', 'B07RWCSBLR']
2024-11-06 20:25:48 :: [list_manager.py          ] - [print_no_discount      ] - [WARNING ] - No discount found for he asins: ['B071VG5N9D', 'B0C5R9F39H', 'B07DFDLYLN', 'B07K47BG6K', 'B0BJBVZ184', 'B07895XQPH', 'B0DBLT2F6Y', 'B08VTPWFWC', 'B0CT8T19BK', 'B0CLP3RNQX']
2024-11-06 20:25:48 :: [list_manager.py          ] - [print_no_discount      ] - [WARNING ] - No discount found for he asins: ['B07GB5V7N3', 'B08PQ374XS', 'B06XDN5KB8', 'B083V6N97F', 'B07XXFVPBS', 'B08PDTT97Y', 'B0C5Y94FFF', 'B08Y826GGK', 'B074DTVQL4', 'B0BHJM64Z3']
2024-11-06 20:25:48 :: [list_manager.py          ] - [print_no_discount      ] - [WARNING ] - No discount found for he asins: ['B0BHJMDYKY', 'B07D2JN5YQ', 'B086PSXRHH', 'B08JZH4RX1', 'B086PX4S77', 'B08TPCP1CJ', 'B08TP7PF5J', 'B06XDCDKCZ', 'B06XCST3F1', 'B0BX4V292G']
2024-11-06 20:25:48 :: [list_manager.py          ] - [print_no_discount      ] - [WARNING ] - No discount found for he asins: ['B0BX4VR7YL', 'B075V49VSB', 'B076HV496D', 'B009LOR2RA', 'B00AHE1BLQ', 'B009IITNR6', 'B0DGV9S6VP', 'B008LVXZ1G', 'B0D7J2SH6F', 'B0DBVZ7N4N']
2024-11-06 20:25:48 :: [list_manager.py          ] - [print_no_discount      ] - [WARNING ] - No discount found for he asins: ['B0C76BCK1R', 'B009ILFXIQ', 'B009EAY698', 'B0BVDRNN2F', 'B0BD63G9T5', 'B0C2RVBC94', 'B009HT53PM', 'B0DB2Z753P', 'B0BNLKNKKB', 'B0093ZA1DE']
2024-11-06 20:25:48 :: [list_manager.py          ] - [print_no_discount      ] - [WARNING ] - No discount found for he asins: ['B07N7983XB', 'B0DJD5ZMGG', 'B0DD87F1RL', 'B0DJ3TD6N1', 'B009F54QCO', 'B009EHZNDO', 'B0DD8GN953', 'B07MX9VSP3', 'B08QZWTK15', 'B07MCV813V']
2024-11-06 20:25:48 :: [list_manager.py          ] - [print_no_discount      ] - [WARNING ] - No discount found for he asins: ['B0D4ZKN5SB', 'B008SZLTP4', 'B08JS9NHRG', 'B00S7C6C28', 'B07MX3LGSV', 'B01ALQ7D2K', 'B0D7ZHG19W', 'B008T9HBHE', 'B08KSKNVV1', 'B07MG8NG6S']
2024-11-06 20:25:48 :: [list_manager.py          ] - [print_no_discount      ] - [WARNING ] - No discount found for he asins: ['B07D9LZBLV', 'B0B7K88QCV', 'B0DJGRW2HS', 'B0CHJDKV74', 'B07B4XY2NR', 'B0D873TXBY', 'B07HYJMVR7', 'B075QN95D5', 'B0DC4C8Y7M', 'B009IBIVN0']
2024-11-06 20:25:48 :: [list_manager.py          ] - [print_no_discount      ] - [WARNING ] - No discount found for he asins: ['B0DK2CW24W', 'B0089E2OJE', 'B001TZ5KRI', 'B01M0XCDOJ', 'B009UWC976', 'B00XUSB4YK', 'B0058NYI66', 'B009ZXZW7E', 'B002EPBL1Q', 'B08VY28PZV']
2024-11-06 20:25:48 :: [list_manager.py          ] - [print_no_discount      ] - [WARNING ] - No discount found for he asins: ['B09TTN7HTT', 'B004AKLKSM', 'B09NYN3YYN', 'B0CC1J8GN8', 'B08RC5J1TT', 'B0DFQK9VKK', 'B09B7DQ5MY', 'B0B6GFJNNL', 'B0CNCKRVNJ', 'B0BKZW9RGB']
2024-11-06 20:25:48 :: [list_manager.py          ] - [print_no_discount      ] - [WARNING ] - No discount found for he asins: ['B09TRG9YSW', 'B08NX1JN9W', 'B08RC68QHN', 'B0C89NQMKR', 'B0B6GCJWZX', 'B0CGRBLDC5', 'B0CFF73ZMZ', 'B08HRLTZBV', 'B09NQD7Z65', 'B003RSMP50']
2024-11-06 20:25:48 :: [list_manager.py          ] - [print_no_discount      ] - [WARNING ] - No discount found for he asins: ['B0BNZDQQV3', 'B07WP9R2ZV', 'B09TF8HF3X', 'B09TPF9RL1', 'B0799RHQHJ', 'B0CBPTK6J6', 'B0CFL1LGHQ', 'B0C6FDCPB1', 'B09QH71RZR', 'B0CRF77622']
2024-11-06 20:25:48 :: [list_manager.py          ] - [print_no_discount      ] - [WARNING ] - No discount found for he asins: ['B0DCJW5LBQ', 'B0DCBKB7TQ', 'B0CNHCL7MK', 'B0BWS8N8P7', 'B0BTJD6LCL', 'B07N1D9MZD', 'B09PFYS1ZZ', 'B0C2HQB3SX', 'B082PWGGMD', 'B07XRHBXM7']
2024-11-06 20:25:48 :: [list_manager.py          ] - [print_no_discount      ] - [WARNING ] - No discount found for he asins: ['B0CZMRTF59', 'B0963DLXJZ', 'B00UTBFWNU', 'B08CB31YL9', 'B0D4F4R48Y', 'B0DCK4PYYH', 'B0CJ9PXCWM', 'B07BYY5XJL', 'B09J2HQJLS', 'B0BV2TTH6J']
2024-11-06 20:25:48 :: [list_manager.py          ] - [print_no_discount      ] - [WARNING ] - No discount found for he asins: ['B08MPTY6R1']
2024-11-06 20:25:48 :: [list_manager.py          ] - [offers_extractor       ] - [INFO    ] - There are 70 offers in the list but the max is 6. Start Swap offers.
2024-11-06 20:25:49 :: [communication_handler.py ] - [single_message         ] - [INFO    ] - Message send successfully for the asin B0BVQ5518V
2024-11-06 20:25:50 :: [communication_handler.py ] - [single_message         ] - [INFO    ] - Message send successfully for the asin B076X3XFN4
2024-11-06 20:25:51 :: [communication_handler.py ] - [single_message         ] - [INFO    ] - Message send successfully for the asin B0CBL2XCNN
2024-11-06 20:25:52 :: [communication_handler.py ] - [single_message         ] - [INFO    ] - Message send successfully for the asin B0859YNNSL
2024-11-06 20:25:52 :: [communication_handler.py ] - [single_message         ] - [INFO    ] - Message send successfully for the asin B0CN12BMRW
2024-11-06 20:25:53 :: [communication_handler.py ] - [single_message         ] - [INFO    ] - Message send successfully for the asin B0DCJPW6J7
2024-11-06 20:25:53 :: [database_builder.py      ] - [correctly_added        ] - [DEBUG   ] - Products with ASINs: ['B0BVQ5518V', 'B076X3XFN4', 'B0CBL2XCNN', 'B0859YNNSL', 'B0CN12BMRW', 'B0DCJPW6J7'] correctly added to the database.
2024-11-06 20:25:53 :: [time_scheduler.py        ] - [waiting_next_iteration ] - [INFO    ] - Waiting 92 minutes before next iteration.

@peppees
Copy link
Author

peppees commented Nov 6, 2024

Yes, the files I sent you are the only ones I modified. Honestly, I don’t understand why it’s not sending the messages. It could be an issue related to Telegram, but I’m not sure what, since the token is correct and the bot has all the permissions. I could try creating a new bot and starting over from scratch.

@Piero24
Copy link
Owner

Piero24 commented Nov 10, 2024

Hi @peppees, have you tried by making a new bot from scratch?

@peppees
Copy link
Author

peppees commented Nov 10, 2024

i will try, but now i can't because i didn't do a sale in the last 30 days so my bot doesn't work right now

@Piero24
Copy link
Owner

Piero24 commented Nov 11, 2024

Unfortunately, we are in the same boat... I'm also out of sales so I can't do other tests... I will try as soon as I have again the possibility to test it.

@peppees
Copy link
Author

peppees commented Nov 15, 2024

Hi Piero

I hope this message finds you well. I wanted to let you know that I’ve regained access to the APIs and have resumed testing the bot.

As part of the testing process, I tried creating a bot from scratch using BotFather, as suggested, but the issue persists. While it successfully identifies offers, it still doesn’t send any messages.
To investigate further, I created a simple Python script to test the message functionality:

import requests

BOT_TOKEN = ""
CHANNEL_ID = "" # E.g., "-1001234567890"
MESSAGE = "Test dal bot"

url = f"https://api.telegram.org/bot{BOT_TOKEN}/sendMessage"
payload = {
"chat_id": CHANNEL_ID,
"text": MESSAGE
}

response = requests.post(url, data=payload)
print(response.json()) # To check for any errors (credentials are, of course, omitted)

Using this script, the message is successfully sent to the channel, confirming that the issue isn’t related to Telegram itself but rather to the other files in the bot setup. I’ve reviewed the files thoroughly multiple times, even redownloaded the original file you provided, and carefully followed all the steps again, but unfortunately, the problem persists.

I’m really unsure what might be causing the issue at this point. Do you have any additional suggestions or insights?

Looking forward to your guidance.

@Piero24
Copy link
Owner

Piero24 commented Nov 15, 2024

Unfortunately, I still don’t have the API key and I don’t know how to test further at the moment without the key… The only thing I can do is guide you in finding the bug, but it will be a rather lengthy process.

First, add print statements to the bot_starter.py and communication_handler.py files so we can see if it gets stuck somewhere.

Also, replace bot.send_message(CHANNEL_ID, html, parse_mode='HTML', reply_markup=markup) with response = bot.send_message(CHANNEL_ID, html, parse_mode='HTML', reply_markup=markup) here at that point, and immediately below it add print(response) so we can see what it says and if it gets stuck anywhere.

@peppees
Copy link
Author

peppees commented Nov 16, 2024

Hi Piero],

As requested, I’ve added the logs to monitor the program flow. From the logs, I can see that the API is being called correctly for each category and page, and the products are being found as expected. Here are some excerpts:

2024-11-16 11:47:40 :: [amz_paapi_sdk.py] - [INFO] - API called Successfully. Category: Beauty - Keyword: Perfumes - Page: 3 - Min Saving Percent: Deactivated
2024-11-16 11:47:40 :: [amz_paapi_sdk.py] - [DEBUG] - Products Found (8/8): ['B00DUUOAVM', 'B096VSFXGZ', ...]

However, I encountered an issue related to the PIL.Image module. The specific error is as follows:

2024-11-16 11:48:16 :: [communication_handler.py ] - [ERROR] - An error occurred while extracting the message information from the product for the asin B00S2WDIGG: module 'PIL.Image' has no attribute 'ANTIALIAS'

To resolve this, I updated the code by replacing Image.ANTIALIAS with Image.Resampling.LANCZOS:
im1_resized = im1.resize((new_width, new_height), Image.Resampling.LANCZOS)

Now, after fixing this error, I’m encountering another one related to image loading. The specific error is as follows:

Extracted offers: 51
Products list after shuffle: 51
Max offers to send: 5
Sending product with ASIN: B0144Z4NCC
An error occurred while extracting the message information from the product for the asin B0144Z4NCC: [Errno 2] No such file or directory: 'C:\Users\cento\Desktop\TelegramBot-AmazonOffers\src\src\media\template\backg-3.jpg'
Failed to send product with ASIN: B0144Z4NCC
Sending product with ASIN: B06XFC9PTY
An error occurred while extracting the message information from the product for the asin B06XFC9PTY: [Errno 2] No such file or directory: 'C:\Users\cento\Desktop\TelegramBot-AmazonOffers\src\src\media\template\backg-2.jpg'
Failed to send product with ASIN: B06XFC9PTY
...

I believe this issue is due to the code entering the src folder twice, which causes the incorrect path. However, I am unsure how to modify the path or where to find the correct file to make this adjustment. Let me know how you’d like to proceed!
Thanks!

@Piero24
Copy link
Owner

Piero24 commented Nov 16, 2024

First of all, these are the basic logs that are already integrated; you need to add the other print statements as indicated to see where it gets stuck. Regarding the PIL module, the error is known with newer versions, and it would need to be changed, but that requires further modifications to the code, which I currently don’t have time to do. Out of curiosity, did you install the dependencies correctly from the txt file with the specified versions, or did you install them manually? If you installed them manually, the issue might be due to having newer versions, which could break the code… check that you have the same versions as specified in the requirements.txt file. In any case, let’s address one problem at a time… let’s first send the messages.

@peppees
Copy link
Author

peppees commented Nov 16, 2024

I followed your instructions and installed the dependencies correctly from the requirements.txt file. However, when I ran the bot, it reported that some libraries were missing, so I downloaded them manually.

Regarding the PIL module issue, as I mentioned in my previous message, I have resolved it. However, the new issue I’m facing is that the bot cannot find the background images in the specified path. I suspect there might be a problem with the image path or folder access permissions, but I’m not sure how to proceed in fixing it.

Let me know what you think.

@Piero24
Copy link
Owner

Piero24 commented Nov 16, 2024

This is strange… all the dependencies must be installed via the requirements file. Installing them manually could cause problems when running the bot. Can you please tell me which packages are missing and provide all the steps that you have taken differently from the guide?

@peppees
Copy link
Author

peppees commented Nov 16, 2024

Hi, the issue was related to the Python version. I downloaded version 3.12.0 and successfully installed all the contents of the requirements.txt file. Now, when I run the bot, it no longer throws any errors, but it still doesn’t send messages to the Telegram channel.

I’m sending you the files that I modified with some added logs. Could you please check if they are correct? Keep in mind that I’m not a programmer, so I’m using ChatGPT to help me figure things out. Let me know if I’m doing anything wrong.

Here’s the modification I made to bot_starter.py:

import time
import random
import logging
import telebot

from utils import time_scheduler
from utils import list_manager
from utils.product import Product
from utils import database_builder
from messages import communication_handler
from configs import settings
from utils.log_manager import setup_logger
from utils import functions_toolbox

setup_logger()
logger = logging.getLogger(__name__)

def start(bot: telebot.TeleBot) -> None:
    print("Start function called.")
    if ((time_scheduler.is_active()) and (time_scheduler.is_not_sunday()) and 
        (not time_scheduler.is_during_holidays(settings.COUNTRY))):
        print("Conditions met for sending offers.")
        
        valid_offers_list = list_manager.extraction_raw_products()
        print(f"Extracted offers: {len(valid_offers_list)}")
        
        products_list = []

        if valid_offers_list:
            products_list_raw = Product.list_to_products(valid_offers_list)
            products_list = database_builder.check_products_in_list(
                products_list_raw, 
                settings.MAX_DAYS_TO_CHECK)

        random.shuffle(products_list)
        print(f"Products list after shuffle: {len(products_list)}")

        if products_list:
            MAX_OFFERS = functions_toolbox.choose_max_offers_number()
            print(f"Max offers to send: {MAX_OFFERS}")
            
            selected_products = list_manager.offers_extractor(products_list, MAX_OFFERS)  
            asin_sended_list = []
            for product in selected_products:
                print(f"Sending product with ASIN: {product.asin}")
                result = communication_handler.single_message(bot, product)

                if result:
                    asin = database_builder.add_to_database(product)
                    asin_sended_list.append(asin)
                    print(f"Product added to database: {asin}")
                else:
                    print(f"Failed to send product with ASIN: {product.asin}")

            database_builder.correctly_added(asin_sended_list)
            time_scheduler.waiting_next_iteration()

        logging.info("Iteration completed.")
        print("Iteration completed.")
    else:
        print("Conditions not met. Bot will wait.")
        time_scheduler.static_waiting_time() 

And here’s the modification I made to communication_handler.py:

import telebot
import logging

from utils.product import Product
from configs import api_keys
from messages.message import Message
from utils.log_manager import setup_logger

setup_logger()
logger = logging.getLogger(__name__)

def single_message(bot: telebot.TeleBot, product: Product) -> bool:
    PARTNER_TAG = api_keys.PARTNER_TAG
    CHANNEL_ID = api_keys.CHANNEL_ID

    try:
        mess = Message.from_product(product, PARTNER_TAG)
    except Exception as e:
        logging.error(f"Error extracting message for ASIN {product.asin}: {e}")
        print(f"Error extracting message for ASIN {product.asin}: {e}")
        return False
    
    try:
        html = Message.html_message(mess)
    except Exception as e:
        logging.error(f"Error creating HTML message for ASIN {product.asin}: {e}")
        print(f"Error creating HTML message for ASIN {product.asin}: {e}")
        return False
    
    try:
        markup = Message.markup_generator(mess, PARTNER_TAG)
    except Exception as e:
        logging.error(f"Error creating markup for ASIN {product.asin}: {e}")
        print(f"Error creating markup for ASIN {product.asin}: {e}")
        return False

    try:    
        print("Sending message to channel")
        response = bot.send_message(CHANNEL_ID, html, parse_mode='HTML', reply_markup=markup)
        print(f"Message response: {response}")
    except Exception as e:
        logging.error(f"Error sending message for ASIN {product.asin}: {e}")
        print(f"Error sending message for ASIN {product.asin}: {e}")
        return False

    logging.info(f"Message sent successfully for ASIN {product.asin}")
    print(f"Message sent successfully for ASIN {product.asin}")
    return True

If the logs are not correct, can you let me know how to fix them? Again, I’m not very experienced in this field, and I apologize for any mistakes.

@Piero24
Copy link
Owner

Piero24 commented Nov 16, 2024

Use instead Python 3.9.6.
Have you tried running the bot with these prints? Does it print print(f"Message response: {response}")? Does it say anything?
Alos which OS are u using (Windows, MacOS, Linux)? Which version?

@peppees
Copy link
Author

peppees commented Nov 17, 2024

ok, I'll try using Python 3.9.6 as soon as I can. Anyway, yes, I tried running the bot with the logs I sent you, but I don’t know why it doesn’t change anything, it shows the same logs as before. I’m using Windows 11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants