0
async def get_file_from_dmf(url: str,path):
    async with aiohttp.ClientSession() as session:
        async with session.get(
                'https://drop1.dropmefile.com/dl' + urlparse(url).path,
                headers={'referer': url}, ssl=False
        ) as response:
            file_name = response.headers['Content-Disposition'][22:-1]
            if 'txt' not in file_name:
                return False
            with open(path, 'wb') as file:
                while True:
                    chunk = await response.content.read(1024)
                    if not chunk:
                        break
                    file.write(chunk)
                return True
url = "https://dropmefiles.com/oCXcN"
asyncio.run(get_file_from_dmf(url,"test.txt"))

Есть такой метод, который принимает ссылку на дропмифайл и скачивает текстовик из нее асинхронно,но с большими файлами он не работает. В чем проблема? Как сделать, чтобы все скачивалось?В примере ссылка с большим файлом.

0

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Посмотрите другие вопросы с метками или задайте свой вопрос.