transition from requests to httpx

This commit is contained in:
be7a
2021-04-23 18:02:57 +02:00
parent c1ab7485e2
commit 44aeb6c2eb
14 changed files with 80 additions and 89 deletions

View File

@@ -6,7 +6,7 @@ from dataclasses import dataclass
from types import TracebackType
from typing import Optional, Type
import requests
import httpx
from rich.console import Console
from rich.progress import (BarColumn, DownloadColumn, Progress, TaskID,
TextColumn, TimeRemainingColumn,
@@ -27,12 +27,12 @@ _progress: Progress = Progress(
)
def size_from_headers(response: requests.Response) -> Optional[int]:
def size_from_headers(response: httpx.Response) -> Optional[int]:
"""
Return the size of the download based on the response headers.
Arguments:
response {requests.Response} -- the response
response {httpx.Response} -- the response
Returns:
Optional[int] -- the size