Result after google [see Post an image file from disk]
In[2]: from telegram import Bot
In[3]: bot = Bot(token)
In[4]: update = bot.get_updates()[0]
In[5]: update
Out[5]: <telegram.update.Update at 0x1a295c18>
In[6]: chat_id = update["message"]["chat"]["id"]
In[7]: bot.send_photo(chat_id=chat_id, photo=open("test.jpg", "rb"))
Traceback (most recent call last):
File "<ipython-input-9-4c19142e0fd3>", line 1, in <module>
bot.send_photo(chat_id=chat_id, photo=open("test.jpg", "rb"))
File "C:\Users\Cheung\Anaconda3\lib\site-packages\telegram\bot.py", line 60, in decorator
result = func(self, *args, **kwargs)
File "C:\Users\Cheung\Anaconda3\lib\site-packages\telegram\bot.py", line 85, in decorator
result = self._request.post(url, data, timeout=kwargs.get('timeout'))
File "C:\Users\Cheung\Anaconda3\lib\site-packages\telegram\utils\request.py", line 265, in post
'POST', url, body=data.to_form(), headers=data.headers, **urlopen_kwargs)
File "C:\Users\Cheung\Anaconda3\lib\site-packages\telegram\utils\request.py", line 196, in _request_wrapper
raise NetworkError('urllib3 HTTPError {0}'.format(error))
NetworkError: urllib3 HTTPError ('Connection aborted.', timeout('The write operation timed out',))
Why doesn't this work?
Maybe I should use the other way to do get file_id instead? But how do I get it?