F
F
fokioff2022-03-20 14:36:00
Python
fokioff, 2022-03-20 14:36:00

What to do with Wrong http url specified aiogram error?

When changing a media file, I encountered an error aiogram.utils.exceptions.BadRequest: Wrong http url specified .
The code:

photo1 = types.InputMediaPhoto('avatar/photos/file_8.jpg')
await bot.edit_message_media(media=photo1, chat_id=call.from_user.id, message_id=call.message.message_id)


What is causing this error?

Full error text:

ERROR:asyncio:Task exception was never retrieved
future: exception=BadRequest('Wrong http url specified')>
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\dispatcher\dispatcher.py", line 415, in _process_polling_updates
for responses in itertools.chain.from_iterable(await self.process_updates(updates, fast)):
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\dispatcher\dispatcher.py", line 235, in process_updates
return await asyncio.gather(*tasks)
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\dispatcher\handler.py", line 116, in notify
response = await handler_obj.handler(*args, **partial_data)
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\dispatcher\dispatcher.py", line 283, in process_update
return await self.callback_query_handlers.notify(update.callback_query)
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\dispatcher\handler.py", line 116, in notify
response = await handler_obj.handler(*args, **partial_data)
File "C:\Users\User\Desktop\testsearchanon\main.py", line 800, in oz1
await bot.edit_message_media(media=photo1, chat_id=call.from_user.id, message_id=call.message.message_id)
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\bot\bot.py", line 2743, in edit_message_media
result = await self.request(api.Methods.EDIT_MESSAGE_MEDIA, payload, files)
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\bot\base.py", line 231, in request
return await api.make_request(await self.get_session(), self.server, self.__token, method, data, files,
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\bot\api.py", line 140, in make_request
return check_result(method, response.content_type, response.status, await response.text())
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\bot\api.py", line 115, in check_result
exceptions.BadRequest.detect(description)
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\aiogram\utils\exceptions.py", line 141, in detect
raise cls(description)
aiogram.utils.exceptions.BadRequest: Wrong http url specified

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
OmegaTortik, 2022-03-20
@OmegaTortik

Media must be from the Internet. That is, a link to an image from the Internet
https://i.pinimg.com/originals/f5/89/8a/f5898ac86f...
like this

S
soremix, 2022-03-20
@SoreMix

See the library examples, depending on where the file is
https://docs.aiogram.dev/en/dev-3.x/api/upload_fil...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question