Telegram으로 그림 파일 보내기

Telegram Bot으로 그림 파일을 보내면 이미지를 손실 압축해서 전송된다. 그래서 화질이 나빠진다. 이미지 그 자체를 보내는 것으로 처리해야 한다.

img = open(filename, 'rb')
response = requests.post(
	f'https://api.telegram.org/bot{TOKEN}/sendDocument',
	data = {'chat_id' : CHAT_ID,
		   'document' : 'attach://file'},
	f'https://api.telegram.org/bot{TOKEN}/sendPhoto?chat_id={CHAT_ID}',
	files={'file':img},
	timeout=5)