Skip to content

Commit

Permalink
Remove python3.7 code
Browse files Browse the repository at this point in the history
  • Loading branch information
perklet committed Feb 4, 2024
1 parent bf56318 commit 0c7ad76
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 24 deletions.
9 changes: 3 additions & 6 deletions curl_cffi/__version__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# New in version 3.8.
# from importlib import metadata
from importlib import metadata
from .curl import Curl


__title__ = "curl_cffi"
# __description__ = metadata.metadata("curl_cffi")["Summary"]
# __version__ = metadata.version("curl_cffi")
__description__ = "libcurl ffi bindings for Python, with impersonation support"
__version__ = "0.6.0b9"
__description__ = metadata.metadata("curl_cffi")["Summary"]
__version__ = metadata.version("curl_cffi")
__curl_version__ = Curl().version().decode()
5 changes: 1 addition & 4 deletions curl_cffi/_asyncio_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@

from typing import Set # noqa: F401

try:
from typing import Protocol
except ImportError:
from typing_extensions import Protocol
from typing import Protocol


class _HasFileno(Protocol):
Expand Down
8 changes: 3 additions & 5 deletions curl_cffi/requests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from functools import partial
from io import BytesIO
from typing import Callable, Dict, Optional, Tuple, Union
from typing import Callable, Dict, Optional, Tuple, Union, Literal


from ..curl import CurlMime
Expand All @@ -32,11 +32,9 @@
from .models import Request, Response
from .errors import RequestsError
from .headers import Headers, HeaderTypes
from .session import AsyncSession, BrowserType, Session, ProxySpec
from .session import AsyncSession, BrowserType, Session, ProxySpec, ThreadType
from .websockets import WebSocket, WebSocketError, WsCloseCode

# ThreadType = Literal["eventlet", "gevent", None]


def request(
method: str,
Expand All @@ -59,7 +57,7 @@ def request(
accept_encoding: Optional[str] = "gzip, deflate, br",
content_callback: Optional[Callable] = None,
impersonate: Optional[Union[str, BrowserType]] = None,
thread: Optional[str] = None,
thread: Optional[ThreadType] = None,
default_headers: Optional[bool] = None,
curl_options: Optional[dict] = None,
http_version: Optional[CurlHttpVersion] = None,
Expand Down
9 changes: 3 additions & 6 deletions curl_cffi/requests/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from functools import partialmethod
from io import BytesIO
from json import dumps
from typing import Callable, Dict, List, Any, Optional, Sequence, Tuple, Union, cast, TYPE_CHECKING
from typing import Callable, Dict, List, Any, Optional, TypedDict, Tuple, Union, cast, TYPE_CHECKING, Literal
from urllib.parse import ParseResult, parse_qsl, unquote, urlencode, urlparse
from concurrent.futures import ThreadPoolExecutor

Expand All @@ -33,7 +33,6 @@
pass

if TYPE_CHECKING:
from typing_extensions import TypedDict

class ProxySpec(TypedDict, total=False):
all: str
Expand All @@ -45,6 +44,7 @@ class ProxySpec(TypedDict, total=False):
else:
ProxySpec = Dict[str, str]

ThreadType = Literal["eventlet", "gevent"]

class BrowserType(str, Enum):
edge99 = "edge99"
Expand Down Expand Up @@ -561,17 +561,14 @@ def _check_session_closed(self):
raise SessionClosed("Session is closed, cannot send request.")


# ThreadType = Literal["eventlet", "gevent", None]


class Session(BaseSession):
"""A request session, cookies and connections will be reused. This object is thread-safe,
but it's recommended to use a seperate session for each thread."""

def __init__(
self,
curl: Optional[Curl] = None,
thread: Optional[str] = None,
thread: Optional[ThreadType] = None,
use_thread_local_curl: bool = True,
**kwargs,
):
Expand Down
3 changes: 0 additions & 3 deletions scripts/bump_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ VERSION=$1
# Makefile
gsed "s/^VERSION := .*/VERSION := ${VERSION}/g" -i Makefile

# curl_cffi/__version__.py
gsed "s/^__version__ = .*/__version__ = \"${VERSION}\"/g" -i curl_cffi/__version__.py

# pyproject.toml
gsed "s/^version = .*/version = \"${VERSION}\"/g" -i pyproject.toml

Expand Down

0 comments on commit 0c7ad76

Please sign in to comment.