forked from deknowny/reqsnaked
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreqsnaked.pyi
167 lines (117 loc) · 3.34 KB
/
reqsnaked.pyi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
import typing
import dataclasses
import datetime
import urllib.parse
import http
import enum
QueryValue = typing.Union[
str, int, bool, None, typing.List[
typing.Union[str, int, bool, None]
]
]
class Bytes:
def as_bytes(self) -> bytes:
pass
def decode(self, encoding: str) -> str:
pass
def guess_encoding(self) -> str:
pass
class Stream:
async def gnaw(self) -> typing.Optional[Bytes]:
pass
class HTTPVersion(enum.Enum):
HTTP_09 = enum.auto()
HTTP_10 = enum.auto()
HTTP_11 = enum.auto()
HTTP_2 = enum.auto()
HTTP_3 = enum.auto()
def to_string(self) -> str:
pass
@dataclasses.dataclass
class HeaderMap:
def to_dict(self) -> typing.Dict[str, bytes]:
pass
def __getitem__(self, item: str) -> bytes:
pass
@dataclasses.dataclass
class LazyJSON:
def query(self, *keys: typing.Union[str, int]) -> typing.Any:
pass
def show(self, *keys: typing.Union[str, int]) -> None:
pass
def contains(self, *keys: typing.Union[str, int]) -> bool:
pass
@dataclasses.dataclass
class Part:
name: str
value: typing.Union[str, bytes]
filename: typing.Optional[str] = None
mime: typing.Optional[str] = None
class Multipart:
def __init__(self, *parts: Part) -> None:
pass
def boundary(self) -> str:
pass
@dataclasses.dataclass
class Request:
method: typing.Union[str, "http.HTTPMethod"]
url: typing.Union[str, urllib.parse.ParseResult]
headers: typing.Optional[typing.Dict[str, str]] = None
query: typing.Optional[typing.Dict[str, QueryValue]] = None
form: typing.Optional[typing.Dict[str, QueryValue]] = None
json: typing.Optional[typing.Any] = None
bearer_auth: typing.Optional[str] = None
body: typing.Optional[bytes] = None
timeout: typing.Optional[typing.Union[int, datetime.timedelta]] = None
multipart: typing.Optional[Multipart] = None
username: typing.Optional[str] = None
password: typing.Optional[str] = None
@dataclasses.dataclass
class Response:
status: http.HTTPStatus
version: HTTPVersion
headers: HeaderMap
async def json(self) -> LazyJSON:
pass
async def read(self) -> Bytes:
pass
def to_stream(self) -> Stream:
pass
@dataclasses.dataclass
class Client:
user_agent: typing.Optional[str] = None
headers: typing.Optional[typing.Dict[str, str]] = None
store_cookie: typing.Optional[bool] = False
max_allowed_redirects: typing.Optional[int] = 10
danger_accept_invalid_certs: typing.Optional[bool] = False
proxy: typing.Optional[str] = None # Add proxy parameter
async def send(self, request) -> Response:
pass
class BorrowingError(RuntimeError):
pass
class BaseReqwestError(Exception):
pass
class BodyError(BaseReqwestError):
pass
class BuilderError(BaseReqwestError):
pass
class ConnectionError(BaseReqwestError):
pass
class DecodingError(BaseReqwestError):
pass
class RedirectError(BaseReqwestError):
pass
class TimeoutError(BaseReqwestError):
pass
class StatusError(BaseReqwestError):
pass
class RequestError(BaseReqwestError):
pass
class UnknownError(BaseReqwestError):
pass
class HTTPMethodParseError(Exception):
pass
class URLParseError(Exception):
pass
class MIMEParseError(Exception):
pass