写爬虫需要., 带下载大小显示, 有空可写成带百分比进度的

def download_requests(url, file_path):
    temp_size = 0
    print(f"开始下载...{url}")
    with requests.get(url, stream=True) as r:
        r.raise_for_status()
        with open(file_path, 'wb') as f:
            for chunk in r.iter_content(chunk_size=1024 * 32):
                temp_size += len(chunk)
                f.write(chunk)
                f.flush()
     
                sys.stdout.write("\r%fmb" % (temp_size / 1024 / 1024))
                sys.stdout.flush()
                
    return file_path