Constructor parameter should be str?

Как решить ошибку?

@command(name="добавить фото")
    async def upload_photo(self, server, *urls):
        try:
            async with aiohttp.ClientSession() as client:
                files = aiohttp.FormData()
                for i, url in enumerate(urls):
                    imbts = await client.get(url)
                    cnt = imbts.content_type
                    ext = cnt[6:]
                    imbts = await imbts.read()
                    files.add_field(f'file{i}', imbts, filename='temp{}.{}'.format(i, ext))
                res = await client.post(server, data=files)
                photos = await res.json(content_type='text/html')
            payload = {
                'album_id': photos['aid'],
                'group_id': photos['gid'],
                'server': photos['server'],
                'photos_list': photos['photos_list'],
                'hash': photos['hash']
                }
            res = await self.bot.user_vk_request('photos.save', **payload)
            uploaded = res['response']
            return [f'photo{file["owner_id"]}_{file["id"]}' for file in uploaded]
        except Exception:
            raise Exception('Произошла ошибка')
  • Вопрос задан
  • 170 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы