ItsCxdy commited on
Commit
087fb69
·
verified ·
1 Parent(s): 6595c15

Update telegram_bot.py

Browse files
Files changed (1) hide show
  1. telegram_bot.py +7 -6
telegram_bot.py CHANGED
@@ -382,16 +382,17 @@ def main():
382
  print("🚀 Starting Telegram Homeopathy Bot...")
383
 
384
  # Create Application
385
- # CRITICAL FIX: Adding request_kwargs to explicitly set network timeouts for the underlying HTTPX client
386
  application = (
387
  Application.builder()
388
  .token(TELEGRAM_TOKEN)
389
- .request_kwargs({
390
  # Explicitly set low timeouts to force failures and retries faster if DNS fails
391
- 'connect_timeout': 5.0, # 5 seconds to establish connection
392
- 'read_timeout': 15.0 # 15 seconds to receive the first byte
393
- })
394
- .build()
 
395
  )
396
 
397
  # Add conversation handler
 
382
  print("🚀 Starting Telegram Homeopathy Bot...")
383
 
384
  # Create Application
385
+ # CRITICAL FIX: The 'request_kwargs' must be passed to .build() method, not chained on the builder object.
386
  application = (
387
  Application.builder()
388
  .token(TELEGRAM_TOKEN)
389
+ .build(
390
  # Explicitly set low timeouts to force failures and retries faster if DNS fails
391
+ request_kwargs={
392
+ 'connect_timeout': 5.0, # 5 seconds to establish connection
393
+ 'read_timeout': 15.0 # 15 seconds to receive the first byte
394
+ }
395
+ )
396
  )
397
 
398
  # Add conversation handler