wreq.blocking
The blocking (synchronous) client provides the same functionality as the async client but with a synchronous API.
wreq.blocking
Response
A blocking response from a request.
Source code in python/wreq/blocking.py
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 | |
raise_for_status
stream
text
json
bytes
close
Close the response.
This method closes the network connection regardless of whether connection pooling is
enabled or not. It is recommended to use context managers (with statement) to properly
manage response lifecycle instead of calling this method manually.
Source code in python/wreq/blocking.py
WebSocket
A blocking WebSocket response.
Source code in python/wreq/blocking.py
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 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | |
recv
send
send_all
Send multiple messages to the WebSocket.
Arguments
messages- The sequence of messages to send.
close
Close the WebSocket connection.
Arguments
code- An optional close code.reason- An optional reason for closing.
Source code in python/wreq/blocking.py
Client
A blocking client for making HTTP requests.
Source code in python/wreq/blocking.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 | |
cookie_jar
instance-attribute
__init__
__init__(*, emulation=..., user_agent=..., headers=..., orig_headers=..., referer=..., redirect=..., raise_for_status=..., cookie_store=..., cookie_provider=..., timeout=..., connect_timeout=..., read_timeout=..., tcp_keepalive=..., tcp_keepalive_interval=..., tcp_keepalive_retries=..., tcp_user_timeout=..., tcp_nodelay=..., tcp_reuse_address=..., pool_idle_timeout=..., pool_max_idle_per_host=..., pool_max_size=..., http1_only=..., http2_only=..., https_only=..., http1_options=..., http2_options=..., tls_verify=..., tls_verify_hostname=..., tls_identity=..., tls_keylog=..., tls_info=..., tls_min_version=..., tls_max_version=..., tls_options=..., no_proxy=..., proxies=..., local_address=..., local_addresses=..., interface=..., dns_options=..., gzip=..., brotli=..., deflate=..., zstd=...)
Creates a new blocking Client instance.
Examples
import asyncio
import wreq
client = wreq.blocking.Client(
user_agent="Mozilla/5.0",
timeout=10,
)
response = client.get('https://httpbin.io/get')
print(response.text())
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emulation
|
Emulation | Profile
|
Emulation config. |
...
|
user_agent
|
str
|
Sets the |
...
|
headers
|
Mapping[str, str] | HeaderMap
|
Sets the default headers for every request. |
...
|
orig_headers
|
Sequence[str] | OrigHeaderMap
|
Sets the original headers for every request. |
...
|
referer
|
bool
|
Enable or disable automatic setting of the |
...
|
redirect
|
Policy
|
Set a |
...
|
raise_for_status
|
bool
|
Enable or disable automatic raising of exceptions for HTTP status codes. |
...
|
cookie_store
|
bool
|
Enable a persistent cookie store for the client. |
...
|
cookie_provider
|
Jar
|
Set the persistent cookie store for the client. Cookies received in responses will be passed to this store, and additional requests will query this store for cookies. By default, no cookie store is used. |
...
|
timeout
|
timedelta
|
Enables a request timeout. The timeout is applied from when the request starts connecting until the response body has finished. Default is no timeout. |
...
|
connect_timeout
|
timedelta
|
Set a timeout for only the connect phase of a |
...
|
read_timeout
|
timedelta
|
Set a timeout for only the read phase of a |
...
|
tcp_keepalive
|
timedelta
|
Set that all sockets have Default is 15 seconds. |
...
|
tcp_keepalive_interval
|
timedelta
|
Set that all sockets have Default is 15 seconds. |
...
|
tcp_keepalive_retries
|
int
|
Set that all sockets have Default is 3 retries. |
...
|
tcp_user_timeout
|
timedelta
|
Set that all sockets have This option controls how long transmitted data may remain unacknowledged before the connection is force-closed. Default is 30 seconds. |
...
|
tcp_nodelay
|
bool
|
Set whether sockets have Default is |
...
|
tcp_reuse_address
|
bool
|
Enable SO_REUSEADDR. |
...
|
pool_idle_timeout
|
timedelta
|
Set an optional timeout for idle sockets being kept-alive. |
...
|
pool_max_idle_per_host
|
int
|
Sets the maximum idle connection per host allowed in the pool. |
...
|
pool_max_size
|
int
|
Sets the maximum number of connections in the pool. |
...
|
http1_only
|
bool
|
Only use HTTP/1. |
...
|
http2_only
|
bool
|
Only use HTTP/2. |
...
|
https_only
|
bool
|
Restrict the Client to be used with HTTPS only requests. |
...
|
http1_options
|
Http1Options
|
Sets the HTTP/1 options for the client. |
...
|
http2_options
|
Http2Options
|
Sets the HTTP/2 options for the client. |
...
|
tls_verify
|
bool | Path | CertStore
|
Sets whether to verify TLS certificates. |
...
|
tls_verify_hostname
|
bool
|
Configures the use of hostname verification when connecting. |
...
|
tls_identity
|
Identity
|
Represents a private key and X509 cert as a client certificate. |
...
|
tls_keylog
|
KeyLog
|
Key logging policy (environment or file). |
...
|
tls_info
|
bool
|
Add TLS information as |
...
|
tls_min_version
|
TlsVersion
|
Minimum TLS version. |
...
|
tls_max_version
|
TlsVersion
|
Maximum TLS version. |
...
|
tls_options
|
TlsOptions
|
Sets the TLS options. |
...
|
no_proxy
|
bool
|
Clear all This also disables the automatic usage of the "system" proxy. |
...
|
proxies
|
Sequence[Proxy]
|
The proxies to use for requests. |
...
|
local_address
|
IPv4Address | IPv6Address
|
Bind to a local IP Address. |
...
|
local_addresses
|
Tuple[IPv4Address | None, IPv6Address | None]
|
Bind to dual-stack local IP Addresses. |
...
|
interface
|
str
|
Bind connections only on the specified network interface. This option is only available on the following operating systems:
On Android, Linux, and Fuchsia, this uses the
Note that connections will fail if the provided interface name is not a network interface that currently exists when a connection is established. |
...
|
dns_options
|
ResolverOptions
|
|
...
|
gzip
|
bool
|
Enable auto gzip decompression by checking the |
...
|
brotli
|
bool
|
Enable auto brotli decompression by checking the |
...
|
deflate
|
bool
|
Enable auto deflate decompression by checking the |
...
|
zstd
|
bool
|
Enable auto zstd decompression by checking the |
...
|
Source code in python/wreq/blocking.py
close
Closes the client and any associated resources.
After calling this method, the client should not be used to make further requests.
Examples:
import asyncio
import wreq
client = wreq.blocking.Client()
response = client.get('https://httpbin.io/get')
print(response.text())
client.close()
Source code in python/wreq/blocking.py
request
request(method, url, *, emulation=..., headers=..., orig_headers=..., default_headers=..., cookies=..., proxy=..., local_address=..., local_addresses=..., interface=..., timeout=..., read_timeout=..., version=..., redirect=..., cookie_provider=..., gzip=..., brotli=..., deflate=..., zstd=..., auth=..., bearer_auth=..., basic_auth=..., query=..., form=..., json=..., body=..., multipart=...)
Sends a request with the given method and URL.
Examples
import wreq
import wreq.blocking
from wreq import Method
client = wreq.blocking.Client()
response = client.request(Method.GET, "https://httpbin.io/anything")
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emulation
|
Emulation | Profile
|
The Emulation settings for the request. |
...
|
headers
|
Mapping[str, str] | HeaderMap
|
The headers to use for the request. |
...
|
orig_headers
|
Sequence[str] | OrigHeaderMap
|
The original headers to use for the request. |
...
|
default_headers
|
bool
|
The option enables default headers. |
...
|
cookies
|
str | Mapping[str, str]
|
The cookies to use for the request. |
...
|
proxy
|
Proxy
|
The proxy to use for the request. |
...
|
local_address
|
IPv4Address | IPv6Address
|
Bind to a local IP Address. |
...
|
local_addresses
|
Tuple[IPv4Address | None, IPv6Address | None]
|
Bind to dual-stack local IP Addresses. |
...
|
interface
|
str
|
Bind connections only on the specified network interface. This option is only available on the following operating systems:
On Android, Linux, and Fuchsia, this uses the
Note that connections will fail if the provided interface name is not a network interface that currently exists when a connection is established. |
...
|
timeout
|
timedelta
|
The timeout to use for the request. |
...
|
read_timeout
|
timedelta
|
The read timeout to use for the request. |
...
|
version
|
Version
|
The HTTP version to use for the request. |
...
|
redirect
|
Policy
|
The redirect policy. |
...
|
cookie_provider
|
Jar
|
Set cookie provider for the request. |
...
|
gzip
|
bool
|
Sets gzip as an accepted encoding. |
...
|
brotli
|
bool
|
Sets brotli as an accepted encoding. |
...
|
deflate
|
bool
|
Sets deflate as an accepted encoding. |
...
|
zstd
|
bool
|
Sets zstd as an accepted encoding. |
...
|
auth
|
str
|
The authentication to use for the request. |
...
|
bearer_auth
|
str
|
The bearer authentication to use for the request. |
...
|
basic_auth
|
Tuple[str, str | None]
|
The basic authentication to use for the request. |
...
|
query
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The query parameters to use for the request. |
...
|
form
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The form parameters to use for the request. |
...
|
json
|
Any
|
The JSON body to use for the request. |
...
|
body
|
str | bytes | Sequence[Tuple[str, str]] | Tuple[str, str | int | float | bool] | Mapping[str, str | int | float | bool] | Any | Generator[bytes, str, None] | AsyncGenerator[bytes, str]
|
The body to use for the request. |
...
|
multipart
|
Multipart
|
The multipart form to use for the request. |
...
|
Source code in python/wreq/blocking.py
websocket
websocket(url, *, emulation=..., proxy=..., local_address=..., local_addresses=..., interface=..., headers=..., orig_headers=..., default_headers=..., cookies=..., protocols=..., version=..., auth=..., bearer_auth=..., basic_auth=..., query=..., read_buffer_size=..., write_buffer_size=..., max_write_buffer_size=..., max_message_size=..., max_frame_size=..., accept_unmasked_frames=...)
Sends a WebSocket request.
Examples
import wreq
import wreq.blocking
client = wreq.blocking.Client()
ws = client.websocket("wss://echo.websocket.org")
ws.send(wreq.Message.from_text("Hello, WebSocket!"))
message = ws.recv()
print("Received:", message.data)
ws.close()
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emulation
|
Emulation | Profile
|
The Emulation settings for the request. |
...
|
proxy
|
Proxy
|
The proxy to use for the request. |
...
|
local_address
|
IPv4Address | IPv6Address
|
Bind to a local IP Address. |
...
|
local_addresses
|
Tuple[IPv4Address | None, IPv6Address | None]
|
Bind to dual-stack local IP Addresses. |
...
|
interface
|
str
|
Bind to an interface by SO_BINDTODEVICE. |
...
|
headers
|
Mapping[str, str] | HeaderMap
|
The headers to use for the request. |
...
|
orig_headers
|
Sequence[str] | OrigHeaderMap
|
The original headers to use for the request. |
...
|
default_headers
|
bool
|
The option enables default headers. |
...
|
cookies
|
str | Mapping[str, str]
|
The cookies to use for the request. |
...
|
protocols
|
Sequence[str]
|
The protocols to use for the request. |
...
|
version
|
Version
|
The HTTP version to use for the request. |
...
|
auth
|
str
|
The authentication to use for the request. |
...
|
bearer_auth
|
str
|
The bearer authentication to use for the request. |
...
|
basic_auth
|
Tuple[str, str | None]
|
The basic authentication to use for the request. |
...
|
query
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The query parameters to use for the request. |
...
|
read_buffer_size
|
int
|
Read buffer capacity. This buffer is eagerly allocated and used for receiving messages. For high read load scenarios a larger buffer, e.g. 128 KiB, improves performance. For scenarios where you expect a lot of connections and don't need high read load performance a smaller buffer, e.g. 4 KiB, would be appropriate to lower total memory usage. The default value is 128 KiB. |
...
|
write_buffer_size
|
int
|
The target minimum size of the write buffer to reach before writing the data to the underlying stream. The default value is 128 KiB. If set to 0 each message will be eagerly written to the underlying stream. It is often more optimal to allow them to buffer a little, hence the default value. Note: flush() will always fully write the buffer regardless. |
...
|
max_write_buffer_size
|
int
|
The max size of the write buffer in bytes. Setting this can provide backpressure in the case the write buffer is filling up due to write errors. The default value is unlimited. Note: The write buffer only builds up past write_buffer_size when writes to the underlying stream are failing. So the write buffer can not fill up if you are not observing write errors even if not flushing. Note: Should always be at least write_buffer_size + 1 message and probably a little more depending on error handling strategy. |
...
|
max_message_size
|
int
|
The maximum size of an incoming message. None means no size limit. The default value is 64 MiB which should be reasonably big for all normal use-cases but small enough to prevent memory eating by a malicious user. |
...
|
max_frame_size
|
int
|
The maximum size of a single incoming message frame. None means no size limit. The limit is for frame payload NOT including the frame header. The default value is 16 MiB which should be reasonably big for all normal use-cases but small enough to prevent memory eating by a malicious user. |
...
|
accept_unmasked_frames
|
bool
|
When set to True, the server will accept and handle unmasked frames from the client. According to RFC 6455, the server must close the connection to the client in such cases, however it seems like there are some popular libraries that are sending unmasked frames, ignoring the RFC. By default this option is set to False, i.e. according to RFC6455. |
...
|
Source code in python/wreq/blocking.py
trace
trace(url, *, emulation=..., headers=..., orig_headers=..., default_headers=..., cookies=..., proxy=..., local_address=..., local_addresses=..., interface=..., timeout=..., read_timeout=..., version=..., redirect=..., cookie_provider=..., gzip=..., brotli=..., deflate=..., zstd=..., auth=..., bearer_auth=..., basic_auth=..., query=..., form=..., json=..., body=..., multipart=...)
Sends a request with the given URL.
Examples
import wreq
import wreq.blocking
from wreq import Method
client = wreq.blocking.Client()
response = client.trace("https://httpbin.io/anything")
print(response.text())
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emulation
|
Emulation | Profile
|
The Emulation settings for the request. |
...
|
headers
|
Mapping[str, str] | HeaderMap
|
The headers to use for the request. |
...
|
orig_headers
|
Sequence[str] | OrigHeaderMap
|
The original headers to use for the request. |
...
|
default_headers
|
bool
|
The option enables default headers. |
...
|
cookies
|
str | Mapping[str, str]
|
The cookies to use for the request. |
...
|
proxy
|
Proxy
|
The proxy to use for the request. |
...
|
local_address
|
IPv4Address | IPv6Address
|
Bind to a local IP Address. |
...
|
local_addresses
|
Tuple[IPv4Address | None, IPv6Address | None]
|
Bind to dual-stack local IP Addresses. |
...
|
interface
|
str
|
Bind connections only on the specified network interface. This option is only available on the following operating systems:
On Android, Linux, and Fuchsia, this uses the
Note that connections will fail if the provided interface name is not a network interface that currently exists when a connection is established. |
...
|
timeout
|
timedelta
|
The timeout to use for the request. |
...
|
read_timeout
|
timedelta
|
The read timeout to use for the request. |
...
|
version
|
Version
|
The HTTP version to use for the request. |
...
|
redirect
|
Policy
|
The redirect policy. |
...
|
cookie_provider
|
Jar
|
Set cookie provider for the request. |
...
|
gzip
|
bool
|
Sets gzip as an accepted encoding. |
...
|
brotli
|
bool
|
Sets brotli as an accepted encoding. |
...
|
deflate
|
bool
|
Sets deflate as an accepted encoding. |
...
|
zstd
|
bool
|
Sets zstd as an accepted encoding. |
...
|
auth
|
str
|
The authentication to use for the request. |
...
|
bearer_auth
|
str
|
The bearer authentication to use for the request. |
...
|
basic_auth
|
Tuple[str, str | None]
|
The basic authentication to use for the request. |
...
|
query
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The query parameters to use for the request. |
...
|
form
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The form parameters to use for the request. |
...
|
json
|
Any
|
The JSON body to use for the request. |
...
|
body
|
str | bytes | Sequence[Tuple[str, str]] | Tuple[str, str | int | float | bool] | Mapping[str, str | int | float | bool] | Any | Generator[bytes, str, None] | AsyncGenerator[bytes, str]
|
The body to use for the request. |
...
|
multipart
|
Multipart
|
The multipart form to use for the request. |
...
|
Source code in python/wreq/blocking.py
options
options(url, *, emulation=..., headers=..., orig_headers=..., default_headers=..., cookies=..., proxy=..., local_address=..., local_addresses=..., interface=..., timeout=..., read_timeout=..., version=..., redirect=..., cookie_provider=..., gzip=..., brotli=..., deflate=..., zstd=..., auth=..., bearer_auth=..., basic_auth=..., query=..., form=..., json=..., body=..., multipart=...)
Sends a request with the given URL.
Examples
import wreq
import wreq.blocking
from wreq import Method
client = wreq.blocking.Client()
response = client.options("https://httpbin.io/anything")
print(response.text())
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emulation
|
Emulation | Profile
|
The Emulation settings for the request. |
...
|
headers
|
Mapping[str, str] | HeaderMap
|
The headers to use for the request. |
...
|
orig_headers
|
Sequence[str] | OrigHeaderMap
|
The original headers to use for the request. |
...
|
default_headers
|
bool
|
The option enables default headers. |
...
|
cookies
|
str | Mapping[str, str]
|
The cookies to use for the request. |
...
|
proxy
|
Proxy
|
The proxy to use for the request. |
...
|
local_address
|
IPv4Address | IPv6Address
|
Bind to a local IP Address. |
...
|
local_addresses
|
Tuple[IPv4Address | None, IPv6Address | None]
|
Bind to dual-stack local IP Addresses. |
...
|
interface
|
str
|
Bind connections only on the specified network interface. This option is only available on the following operating systems:
On Android, Linux, and Fuchsia, this uses the
Note that connections will fail if the provided interface name is not a network interface that currently exists when a connection is established. |
...
|
timeout
|
timedelta
|
The timeout to use for the request. |
...
|
read_timeout
|
timedelta
|
The read timeout to use for the request. |
...
|
version
|
Version
|
The HTTP version to use for the request. |
...
|
redirect
|
Policy
|
The redirect policy. |
...
|
cookie_provider
|
Jar
|
Set cookie provider for the request. |
...
|
gzip
|
bool
|
Sets gzip as an accepted encoding. |
...
|
brotli
|
bool
|
Sets brotli as an accepted encoding. |
...
|
deflate
|
bool
|
Sets deflate as an accepted encoding. |
...
|
zstd
|
bool
|
Sets zstd as an accepted encoding. |
...
|
auth
|
str
|
The authentication to use for the request. |
...
|
bearer_auth
|
str
|
The bearer authentication to use for the request. |
...
|
basic_auth
|
Tuple[str, str | None]
|
The basic authentication to use for the request. |
...
|
query
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The query parameters to use for the request. |
...
|
form
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The form parameters to use for the request. |
...
|
json
|
Any
|
The JSON body to use for the request. |
...
|
body
|
str | bytes | Sequence[Tuple[str, str]] | Tuple[str, str | int | float | bool] | Mapping[str, str | int | float | bool] | Any | Generator[bytes, str, None] | AsyncGenerator[bytes, str]
|
The body to use for the request. |
...
|
multipart
|
Multipart
|
The multipart form to use for the request. |
...
|
Source code in python/wreq/blocking.py
head
head(url, *, emulation=..., headers=..., orig_headers=..., default_headers=..., cookies=..., proxy=..., local_address=..., local_addresses=..., interface=..., timeout=..., read_timeout=..., version=..., redirect=..., cookie_provider=..., gzip=..., brotli=..., deflate=..., zstd=..., auth=..., bearer_auth=..., basic_auth=..., query=..., form=..., json=..., body=..., multipart=...)
Sends a request with the given URL.
Examples
import wreq
import wreq.blocking
from wreq import Method
client = wreq.blocking.Client()
response = client.head("https://httpbin.io/anything")
print(response.text())
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emulation
|
Emulation | Profile
|
The Emulation settings for the request. |
...
|
headers
|
Mapping[str, str] | HeaderMap
|
The headers to use for the request. |
...
|
orig_headers
|
Sequence[str] | OrigHeaderMap
|
The original headers to use for the request. |
...
|
default_headers
|
bool
|
The option enables default headers. |
...
|
cookies
|
str | Mapping[str, str]
|
The cookies to use for the request. |
...
|
proxy
|
Proxy
|
The proxy to use for the request. |
...
|
local_address
|
IPv4Address | IPv6Address
|
Bind to a local IP Address. |
...
|
local_addresses
|
Tuple[IPv4Address | None, IPv6Address | None]
|
Bind to dual-stack local IP Addresses. |
...
|
interface
|
str
|
Bind connections only on the specified network interface. This option is only available on the following operating systems:
On Android, Linux, and Fuchsia, this uses the
Note that connections will fail if the provided interface name is not a network interface that currently exists when a connection is established. |
...
|
timeout
|
timedelta
|
The timeout to use for the request. |
...
|
read_timeout
|
timedelta
|
The read timeout to use for the request. |
...
|
version
|
Version
|
The HTTP version to use for the request. |
...
|
redirect
|
Policy
|
The redirect policy. |
...
|
cookie_provider
|
Jar
|
Set cookie provider for the request. |
...
|
gzip
|
bool
|
Sets gzip as an accepted encoding. |
...
|
brotli
|
bool
|
Sets brotli as an accepted encoding. |
...
|
deflate
|
bool
|
Sets deflate as an accepted encoding. |
...
|
zstd
|
bool
|
Sets zstd as an accepted encoding. |
...
|
auth
|
str
|
The authentication to use for the request. |
...
|
bearer_auth
|
str
|
The bearer authentication to use for the request. |
...
|
basic_auth
|
Tuple[str, str | None]
|
The basic authentication to use for the request. |
...
|
query
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The query parameters to use for the request. |
...
|
form
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The form parameters to use for the request. |
...
|
json
|
Any
|
The JSON body to use for the request. |
...
|
body
|
str | bytes | Sequence[Tuple[str, str]] | Tuple[str, str | int | float | bool] | Mapping[str, str | int | float | bool] | Any | Generator[bytes, str, None] | AsyncGenerator[bytes, str]
|
The body to use for the request. |
...
|
multipart
|
Multipart
|
The multipart form to use for the request. |
...
|
Source code in python/wreq/blocking.py
delete
delete(url, *, emulation=..., headers=..., orig_headers=..., default_headers=..., cookies=..., proxy=..., local_address=..., local_addresses=..., interface=..., timeout=..., read_timeout=..., version=..., redirect=..., cookie_provider=..., gzip=..., brotli=..., deflate=..., zstd=..., auth=..., bearer_auth=..., basic_auth=..., query=..., form=..., json=..., body=..., multipart=...)
Sends a request with the given URL.
Examples
import wreq
import wreq.blocking
from wreq import Method
client = wreq.blocking.Client()
response = client.delete("https://httpbin.io/anything")
print(response.text())
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emulation
|
Emulation | Profile
|
The Emulation settings for the request. |
...
|
headers
|
Mapping[str, str] | HeaderMap
|
The headers to use for the request. |
...
|
orig_headers
|
Sequence[str] | OrigHeaderMap
|
The original headers to use for the request. |
...
|
default_headers
|
bool
|
The option enables default headers. |
...
|
cookies
|
str | Mapping[str, str]
|
The cookies to use for the request. |
...
|
proxy
|
Proxy
|
The proxy to use for the request. |
...
|
local_address
|
IPv4Address | IPv6Address
|
Bind to a local IP Address. |
...
|
local_addresses
|
Tuple[IPv4Address | None, IPv6Address | None]
|
Bind to dual-stack local IP Addresses. |
...
|
interface
|
str
|
Bind connections only on the specified network interface. This option is only available on the following operating systems:
On Android, Linux, and Fuchsia, this uses the
Note that connections will fail if the provided interface name is not a network interface that currently exists when a connection is established. |
...
|
timeout
|
timedelta
|
The timeout to use for the request. |
...
|
read_timeout
|
timedelta
|
The read timeout to use for the request. |
...
|
version
|
Version
|
The HTTP version to use for the request. |
...
|
redirect
|
Policy
|
The redirect policy. |
...
|
cookie_provider
|
Jar
|
Set cookie provider for the request. |
...
|
gzip
|
bool
|
Sets gzip as an accepted encoding. |
...
|
brotli
|
bool
|
Sets brotli as an accepted encoding. |
...
|
deflate
|
bool
|
Sets deflate as an accepted encoding. |
...
|
zstd
|
bool
|
Sets zstd as an accepted encoding. |
...
|
auth
|
str
|
The authentication to use for the request. |
...
|
bearer_auth
|
str
|
The bearer authentication to use for the request. |
...
|
basic_auth
|
Tuple[str, str | None]
|
The basic authentication to use for the request. |
...
|
query
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The query parameters to use for the request. |
...
|
form
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The form parameters to use for the request. |
...
|
json
|
Any
|
The JSON body to use for the request. |
...
|
body
|
str | bytes | Sequence[Tuple[str, str]] | Tuple[str, str | int | float | bool] | Mapping[str, str | int | float | bool] | Any | Generator[bytes, str, None] | AsyncGenerator[bytes, str]
|
The body to use for the request. |
...
|
multipart
|
Multipart
|
The multipart form to use for the request. |
...
|
Source code in python/wreq/blocking.py
patch
patch(url, *, emulation=..., headers=..., orig_headers=..., default_headers=..., cookies=..., proxy=..., local_address=..., local_addresses=..., interface=..., timeout=..., read_timeout=..., version=..., redirect=..., cookie_provider=..., gzip=..., brotli=..., deflate=..., zstd=..., auth=..., bearer_auth=..., basic_auth=..., query=..., form=..., json=..., body=..., multipart=...)
Sends a request with the given URL.
Examples
import wreq
import wreq.blocking
from wreq import Method
client = wreq.blocking.Client()
response = client.patch("https://httpbin.io/anything", json={"key": "value"})
print(response.text())
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emulation
|
Emulation | Profile
|
The Emulation settings for the request. |
...
|
headers
|
Mapping[str, str] | HeaderMap
|
The headers to use for the request. |
...
|
orig_headers
|
Sequence[str] | OrigHeaderMap
|
The original headers to use for the request. |
...
|
default_headers
|
bool
|
The option enables default headers. |
...
|
cookies
|
str | Mapping[str, str]
|
The cookies to use for the request. |
...
|
proxy
|
Proxy
|
The proxy to use for the request. |
...
|
local_address
|
IPv4Address | IPv6Address
|
Bind to a local IP Address. |
...
|
local_addresses
|
Tuple[IPv4Address | None, IPv6Address | None]
|
Bind to dual-stack local IP Addresses. |
...
|
interface
|
str
|
Bind connections only on the specified network interface. This option is only available on the following operating systems:
On Android, Linux, and Fuchsia, this uses the
Note that connections will fail if the provided interface name is not a network interface that currently exists when a connection is established. |
...
|
timeout
|
timedelta
|
The timeout to use for the request. |
...
|
read_timeout
|
timedelta
|
The read timeout to use for the request. |
...
|
version
|
Version
|
The HTTP version to use for the request. |
...
|
redirect
|
Policy
|
The redirect policy. |
...
|
cookie_provider
|
Jar
|
Set cookie provider for the request. |
...
|
gzip
|
bool
|
Sets gzip as an accepted encoding. |
...
|
brotli
|
bool
|
Sets brotli as an accepted encoding. |
...
|
deflate
|
bool
|
Sets deflate as an accepted encoding. |
...
|
zstd
|
bool
|
Sets zstd as an accepted encoding. |
...
|
auth
|
str
|
The authentication to use for the request. |
...
|
bearer_auth
|
str
|
The bearer authentication to use for the request. |
...
|
basic_auth
|
Tuple[str, str | None]
|
The basic authentication to use for the request. |
...
|
query
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The query parameters to use for the request. |
...
|
form
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The form parameters to use for the request. |
...
|
json
|
Any
|
The JSON body to use for the request. |
...
|
body
|
str | bytes | Sequence[Tuple[str, str]] | Tuple[str, str | int | float | bool] | Mapping[str, str | int | float | bool] | Any | Generator[bytes, str, None] | AsyncGenerator[bytes, str]
|
The body to use for the request. |
...
|
multipart
|
Multipart
|
The multipart form to use for the request. |
...
|
Source code in python/wreq/blocking.py
put
put(url, *, emulation=..., headers=..., orig_headers=..., default_headers=..., cookies=..., proxy=..., local_address=..., local_addresses=..., interface=..., timeout=..., read_timeout=..., version=..., redirect=..., cookie_provider=..., gzip=..., brotli=..., deflate=..., zstd=..., auth=..., bearer_auth=..., basic_auth=..., query=..., form=..., json=..., body=..., multipart=...)
Sends a request with the given URL.
Examples
import wreq
import wreq.blocking
from wreq import Method
client = wreq.blocking.Client()
response = client.put("https://httpbin.io/anything", json={"key": "value"})
print(response.text())
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emulation
|
Emulation | Profile
|
The Emulation settings for the request. |
...
|
headers
|
Mapping[str, str] | HeaderMap
|
The headers to use for the request. |
...
|
orig_headers
|
Sequence[str] | OrigHeaderMap
|
The original headers to use for the request. |
...
|
default_headers
|
bool
|
The option enables default headers. |
...
|
cookies
|
str | Mapping[str, str]
|
The cookies to use for the request. |
...
|
proxy
|
Proxy
|
The proxy to use for the request. |
...
|
local_address
|
IPv4Address | IPv6Address
|
Bind to a local IP Address. |
...
|
local_addresses
|
Tuple[IPv4Address | None, IPv6Address | None]
|
Bind to dual-stack local IP Addresses. |
...
|
interface
|
str
|
Bind connections only on the specified network interface. This option is only available on the following operating systems:
On Android, Linux, and Fuchsia, this uses the
Note that connections will fail if the provided interface name is not a network interface that currently exists when a connection is established. |
...
|
timeout
|
timedelta
|
The timeout to use for the request. |
...
|
read_timeout
|
timedelta
|
The read timeout to use for the request. |
...
|
version
|
Version
|
The HTTP version to use for the request. |
...
|
redirect
|
Policy
|
The redirect policy. |
...
|
cookie_provider
|
Jar
|
Set cookie provider for the request. |
...
|
gzip
|
bool
|
Sets gzip as an accepted encoding. |
...
|
brotli
|
bool
|
Sets brotli as an accepted encoding. |
...
|
deflate
|
bool
|
Sets deflate as an accepted encoding. |
...
|
zstd
|
bool
|
Sets zstd as an accepted encoding. |
...
|
auth
|
str
|
The authentication to use for the request. |
...
|
bearer_auth
|
str
|
The bearer authentication to use for the request. |
...
|
basic_auth
|
Tuple[str, str | None]
|
The basic authentication to use for the request. |
...
|
query
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The query parameters to use for the request. |
...
|
form
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The form parameters to use for the request. |
...
|
json
|
Any
|
The JSON body to use for the request. |
...
|
body
|
str | bytes | Sequence[Tuple[str, str]] | Tuple[str, str | int | float | bool] | Mapping[str, str | int | float | bool] | Any | Generator[bytes, str, None] | AsyncGenerator[bytes, str]
|
The body to use for the request. |
...
|
multipart
|
Multipart
|
The multipart form to use for the request. |
...
|
Source code in python/wreq/blocking.py
post
post(url, *, emulation=..., headers=..., orig_headers=..., default_headers=..., cookies=..., proxy=..., local_address=..., local_addresses=..., interface=..., timeout=..., read_timeout=..., version=..., redirect=..., cookie_provider=..., gzip=..., brotli=..., deflate=..., zstd=..., auth=..., bearer_auth=..., basic_auth=..., query=..., form=..., json=..., body=..., multipart=...)
Sends a request with the given URL.
Examples
import wreq
import wreq.blocking
from wreq import Method
client = wreq.blocking.Client()
response = client.post("https://httpbin.io/anything", json={"key": "value"})
print(response.text())
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emulation
|
Emulation | Profile
|
The Emulation settings for the request. |
...
|
headers
|
Mapping[str, str] | HeaderMap
|
The headers to use for the request. |
...
|
orig_headers
|
Sequence[str] | OrigHeaderMap
|
The original headers to use for the request. |
...
|
default_headers
|
bool
|
The option enables default headers. |
...
|
cookies
|
str | Mapping[str, str]
|
The cookies to use for the request. |
...
|
proxy
|
Proxy
|
The proxy to use for the request. |
...
|
local_address
|
IPv4Address | IPv6Address
|
Bind to a local IP Address. |
...
|
local_addresses
|
Tuple[IPv4Address | None, IPv6Address | None]
|
Bind to dual-stack local IP Addresses. |
...
|
interface
|
str
|
Bind connections only on the specified network interface. This option is only available on the following operating systems:
On Android, Linux, and Fuchsia, this uses the
Note that connections will fail if the provided interface name is not a network interface that currently exists when a connection is established. |
...
|
timeout
|
timedelta
|
The timeout to use for the request. |
...
|
read_timeout
|
timedelta
|
The read timeout to use for the request. |
...
|
version
|
Version
|
The HTTP version to use for the request. |
...
|
redirect
|
Policy
|
The redirect policy. |
...
|
cookie_provider
|
Jar
|
Set cookie provider for the request. |
...
|
gzip
|
bool
|
Sets gzip as an accepted encoding. |
...
|
brotli
|
bool
|
Sets brotli as an accepted encoding. |
...
|
deflate
|
bool
|
Sets deflate as an accepted encoding. |
...
|
zstd
|
bool
|
Sets zstd as an accepted encoding. |
...
|
auth
|
str
|
The authentication to use for the request. |
...
|
bearer_auth
|
str
|
The bearer authentication to use for the request. |
...
|
basic_auth
|
Tuple[str, str | None]
|
The basic authentication to use for the request. |
...
|
query
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The query parameters to use for the request. |
...
|
form
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The form parameters to use for the request. |
...
|
json
|
Any
|
The JSON body to use for the request. |
...
|
body
|
str | bytes | Sequence[Tuple[str, str]] | Tuple[str, str | int | float | bool] | Mapping[str, str | int | float | bool] | Any | Generator[bytes, str, None] | AsyncGenerator[bytes, str]
|
The body to use for the request. |
...
|
multipart
|
Multipart
|
The multipart form to use for the request. |
...
|
Source code in python/wreq/blocking.py
get
get(url, *, emulation=..., headers=..., orig_headers=..., default_headers=..., cookies=..., proxy=..., local_address=..., local_addresses=..., interface=..., timeout=..., read_timeout=..., version=..., redirect=..., cookie_provider=..., gzip=..., brotli=..., deflate=..., zstd=..., auth=..., bearer_auth=..., basic_auth=..., query=..., form=..., json=..., body=..., multipart=...)
Sends a request with the given URL.
Examples
import wreq
import wreq.blocking
from wreq import Method
client = wreq.blocking.Client()
response = client.get("https://httpbin.io/anything")
print(response.text())
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emulation
|
Emulation | Profile
|
The Emulation settings for the request. |
...
|
headers
|
Mapping[str, str] | HeaderMap
|
The headers to use for the request. |
...
|
orig_headers
|
Sequence[str] | OrigHeaderMap
|
The original headers to use for the request. |
...
|
default_headers
|
bool
|
The option enables default headers. |
...
|
cookies
|
str | Mapping[str, str]
|
The cookies to use for the request. |
...
|
proxy
|
Proxy
|
The proxy to use for the request. |
...
|
local_address
|
IPv4Address | IPv6Address
|
Bind to a local IP Address. |
...
|
local_addresses
|
Tuple[IPv4Address | None, IPv6Address | None]
|
Bind to dual-stack local IP Addresses. |
...
|
interface
|
str
|
Bind connections only on the specified network interface. This option is only available on the following operating systems:
On Android, Linux, and Fuchsia, this uses the
Note that connections will fail if the provided interface name is not a network interface that currently exists when a connection is established. |
...
|
timeout
|
timedelta
|
The timeout to use for the request. |
...
|
read_timeout
|
timedelta
|
The read timeout to use for the request. |
...
|
version
|
Version
|
The HTTP version to use for the request. |
...
|
redirect
|
Policy
|
The redirect policy. |
...
|
cookie_provider
|
Jar
|
Set cookie provider for the request. |
...
|
gzip
|
bool
|
Sets gzip as an accepted encoding. |
...
|
brotli
|
bool
|
Sets brotli as an accepted encoding. |
...
|
deflate
|
bool
|
Sets deflate as an accepted encoding. |
...
|
zstd
|
bool
|
Sets zstd as an accepted encoding. |
...
|
auth
|
str
|
The authentication to use for the request. |
...
|
bearer_auth
|
str
|
The bearer authentication to use for the request. |
...
|
basic_auth
|
Tuple[str, str | None]
|
The basic authentication to use for the request. |
...
|
query
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The query parameters to use for the request. |
...
|
form
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The form parameters to use for the request. |
...
|
json
|
Any
|
The JSON body to use for the request. |
...
|
body
|
str | bytes | Sequence[Tuple[str, str]] | Tuple[str, str | int | float | bool] | Mapping[str, str | int | float | bool] | Any | Generator[bytes, str, None] | AsyncGenerator[bytes, str]
|
The body to use for the request. |
...
|
multipart
|
Multipart
|
The multipart form to use for the request. |
...
|
Source code in python/wreq/blocking.py
delete
delete(url, *, emulation=..., headers=..., orig_headers=..., default_headers=..., cookies=..., proxy=..., local_address=..., local_addresses=..., interface=..., timeout=..., read_timeout=..., version=..., redirect=..., cookie_provider=..., gzip=..., brotli=..., deflate=..., zstd=..., auth=..., bearer_auth=..., basic_auth=..., query=..., form=..., json=..., body=..., multipart=...)
Shortcut method to quickly make a request.
Examples
import wreq
import wreq.blocking
response = wreq.blocking.delete("https://httpbin.io/anything")
print(response.text())
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emulation
|
Emulation | Profile
|
The Emulation settings for the request. |
...
|
headers
|
Mapping[str, str] | HeaderMap
|
The headers to use for the request. |
...
|
orig_headers
|
Sequence[str] | OrigHeaderMap
|
The original headers to use for the request. |
...
|
default_headers
|
bool
|
The option enables default headers. |
...
|
cookies
|
str | Mapping[str, str]
|
The cookies to use for the request. |
...
|
proxy
|
Proxy
|
The proxy to use for the request. |
...
|
local_address
|
IPv4Address | IPv6Address
|
Bind to a local IP Address. |
...
|
local_addresses
|
Tuple[IPv4Address | None, IPv6Address | None]
|
Bind to dual-stack local IP Addresses. |
...
|
interface
|
str
|
Bind connections only on the specified network interface. This option is only available on the following operating systems:
On Android, Linux, and Fuchsia, this uses the
Note that connections will fail if the provided interface name is not a network interface that currently exists when a connection is established. |
...
|
timeout
|
timedelta
|
The timeout to use for the request. |
...
|
read_timeout
|
timedelta
|
The read timeout to use for the request. |
...
|
version
|
Version
|
The HTTP version to use for the request. |
...
|
redirect
|
Policy
|
The redirect policy. |
...
|
cookie_provider
|
Jar
|
Set cookie provider for the request. |
...
|
gzip
|
bool
|
Sets gzip as an accepted encoding. |
...
|
brotli
|
bool
|
Sets brotli as an accepted encoding. |
...
|
deflate
|
bool
|
Sets deflate as an accepted encoding. |
...
|
zstd
|
bool
|
Sets zstd as an accepted encoding. |
...
|
auth
|
str
|
The authentication to use for the request. |
...
|
bearer_auth
|
str
|
The bearer authentication to use for the request. |
...
|
basic_auth
|
Tuple[str, str | None]
|
The basic authentication to use for the request. |
...
|
query
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The query parameters to use for the request. |
...
|
form
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The form parameters to use for the request. |
...
|
json
|
Any
|
The JSON body to use for the request. |
...
|
body
|
str | bytes | Sequence[Tuple[str, str]] | Tuple[str, str | int | float | bool] | Mapping[str, str | int | float | bool] | Any | Generator[bytes, str, None] | AsyncGenerator[bytes, str]
|
The body to use for the request. |
...
|
multipart
|
Multipart
|
The multipart form to use for the request. |
...
|
Source code in python/wreq/blocking.py
get
get(url, *, emulation=..., headers=..., orig_headers=..., default_headers=..., cookies=..., proxy=..., local_address=..., local_addresses=..., interface=..., timeout=..., read_timeout=..., version=..., redirect=..., cookie_provider=..., gzip=..., brotli=..., deflate=..., zstd=..., auth=..., bearer_auth=..., basic_auth=..., query=..., form=..., json=..., body=..., multipart=...)
Shortcut method to quickly make a request.
Examples
import wreq
import wreq.blocking
response = wreq.blocking.get("https://httpbin.io/anything")
print(response.text())
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emulation
|
Emulation | Profile
|
The Emulation settings for the request. |
...
|
headers
|
Mapping[str, str] | HeaderMap
|
The headers to use for the request. |
...
|
orig_headers
|
Sequence[str] | OrigHeaderMap
|
The original headers to use for the request. |
...
|
default_headers
|
bool
|
The option enables default headers. |
...
|
cookies
|
str | Mapping[str, str]
|
The cookies to use for the request. |
...
|
proxy
|
Proxy
|
The proxy to use for the request. |
...
|
local_address
|
IPv4Address | IPv6Address
|
Bind to a local IP Address. |
...
|
local_addresses
|
Tuple[IPv4Address | None, IPv6Address | None]
|
Bind to dual-stack local IP Addresses. |
...
|
interface
|
str
|
Bind connections only on the specified network interface. This option is only available on the following operating systems:
On Android, Linux, and Fuchsia, this uses the
Note that connections will fail if the provided interface name is not a network interface that currently exists when a connection is established. |
...
|
timeout
|
timedelta
|
The timeout to use for the request. |
...
|
read_timeout
|
timedelta
|
The read timeout to use for the request. |
...
|
version
|
Version
|
The HTTP version to use for the request. |
...
|
redirect
|
Policy
|
The redirect policy. |
...
|
cookie_provider
|
Jar
|
Set cookie provider for the request. |
...
|
gzip
|
bool
|
Sets gzip as an accepted encoding. |
...
|
brotli
|
bool
|
Sets brotli as an accepted encoding. |
...
|
deflate
|
bool
|
Sets deflate as an accepted encoding. |
...
|
zstd
|
bool
|
Sets zstd as an accepted encoding. |
...
|
auth
|
str
|
The authentication to use for the request. |
...
|
bearer_auth
|
str
|
The bearer authentication to use for the request. |
...
|
basic_auth
|
Tuple[str, str | None]
|
The basic authentication to use for the request. |
...
|
query
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The query parameters to use for the request. |
...
|
form
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The form parameters to use for the request. |
...
|
json
|
Any
|
The JSON body to use for the request. |
...
|
body
|
str | bytes | Sequence[Tuple[str, str]] | Tuple[str, str | int | float | bool] | Mapping[str, str | int | float | bool] | Any | Generator[bytes, str, None] | AsyncGenerator[bytes, str]
|
The body to use for the request. |
...
|
multipart
|
Multipart
|
The multipart form to use for the request. |
...
|
Source code in python/wreq/blocking.py
head
head(url, *, emulation=..., headers=..., orig_headers=..., default_headers=..., cookies=..., proxy=..., local_address=..., local_addresses=..., interface=..., timeout=..., read_timeout=..., version=..., redirect=..., cookie_provider=..., gzip=..., brotli=..., deflate=..., zstd=..., auth=..., bearer_auth=..., basic_auth=..., query=..., form=..., json=..., body=..., multipart=...)
Shortcut method to quickly make a request.
Examples
import wreq
import wreq.blocking
response = wreq.blocking.head("https://httpbin.io/anything")
print(response.status)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emulation
|
Emulation | Profile
|
The Emulation settings for the request. |
...
|
headers
|
Mapping[str, str] | HeaderMap
|
The headers to use for the request. |
...
|
orig_headers
|
Sequence[str] | OrigHeaderMap
|
The original headers to use for the request. |
...
|
default_headers
|
bool
|
The option enables default headers. |
...
|
cookies
|
str | Mapping[str, str]
|
The cookies to use for the request. |
...
|
proxy
|
Proxy
|
The proxy to use for the request. |
...
|
local_address
|
IPv4Address | IPv6Address
|
Bind to a local IP Address. |
...
|
local_addresses
|
Tuple[IPv4Address | None, IPv6Address | None]
|
Bind to dual-stack local IP Addresses. |
...
|
interface
|
str
|
Bind connections only on the specified network interface. This option is only available on the following operating systems:
On Android, Linux, and Fuchsia, this uses the
Note that connections will fail if the provided interface name is not a network interface that currently exists when a connection is established. |
...
|
timeout
|
timedelta
|
The timeout to use for the request. |
...
|
read_timeout
|
timedelta
|
The read timeout to use for the request. |
...
|
version
|
Version
|
The HTTP version to use for the request. |
...
|
redirect
|
Policy
|
The redirect policy. |
...
|
cookie_provider
|
Jar
|
Set cookie provider for the request. |
...
|
gzip
|
bool
|
Sets gzip as an accepted encoding. |
...
|
brotli
|
bool
|
Sets brotli as an accepted encoding. |
...
|
deflate
|
bool
|
Sets deflate as an accepted encoding. |
...
|
zstd
|
bool
|
Sets zstd as an accepted encoding. |
...
|
auth
|
str
|
The authentication to use for the request. |
...
|
bearer_auth
|
str
|
The bearer authentication to use for the request. |
...
|
basic_auth
|
Tuple[str, str | None]
|
The basic authentication to use for the request. |
...
|
query
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The query parameters to use for the request. |
...
|
form
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The form parameters to use for the request. |
...
|
json
|
Any
|
The JSON body to use for the request. |
...
|
body
|
str | bytes | Sequence[Tuple[str, str]] | Tuple[str, str | int | float | bool] | Mapping[str, str | int | float | bool] | Any | Generator[bytes, str, None] | AsyncGenerator[bytes, str]
|
The body to use for the request. |
...
|
multipart
|
Multipart
|
The multipart form to use for the request. |
...
|
Source code in python/wreq/blocking.py
options
options(url, *, emulation=..., headers=..., orig_headers=..., default_headers=..., cookies=..., proxy=..., local_address=..., local_addresses=..., interface=..., timeout=..., read_timeout=..., version=..., redirect=..., cookie_provider=..., gzip=..., brotli=..., deflate=..., zstd=..., auth=..., bearer_auth=..., basic_auth=..., query=..., form=..., json=..., body=..., multipart=...)
Shortcut method to quickly make a request.
Examples
import wreq
import wreq.blocking
response = wreq.blocking.options("https://httpbin.io/anything")
print(response.status)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emulation
|
Emulation | Profile
|
The Emulation settings for the request. |
...
|
headers
|
Mapping[str, str] | HeaderMap
|
The headers to use for the request. |
...
|
orig_headers
|
Sequence[str] | OrigHeaderMap
|
The original headers to use for the request. |
...
|
default_headers
|
bool
|
The option enables default headers. |
...
|
cookies
|
str | Mapping[str, str]
|
The cookies to use for the request. |
...
|
proxy
|
Proxy
|
The proxy to use for the request. |
...
|
local_address
|
IPv4Address | IPv6Address
|
Bind to a local IP Address. |
...
|
local_addresses
|
Tuple[IPv4Address | None, IPv6Address | None]
|
Bind to dual-stack local IP Addresses. |
...
|
interface
|
str
|
Bind connections only on the specified network interface. This option is only available on the following operating systems:
On Android, Linux, and Fuchsia, this uses the
Note that connections will fail if the provided interface name is not a network interface that currently exists when a connection is established. |
...
|
timeout
|
timedelta
|
The timeout to use for the request. |
...
|
read_timeout
|
timedelta
|
The read timeout to use for the request. |
...
|
version
|
Version
|
The HTTP version to use for the request. |
...
|
redirect
|
Policy
|
The redirect policy. |
...
|
cookie_provider
|
Jar
|
Set cookie provider for the request. |
...
|
gzip
|
bool
|
Sets gzip as an accepted encoding. |
...
|
brotli
|
bool
|
Sets brotli as an accepted encoding. |
...
|
deflate
|
bool
|
Sets deflate as an accepted encoding. |
...
|
zstd
|
bool
|
Sets zstd as an accepted encoding. |
...
|
auth
|
str
|
The authentication to use for the request. |
...
|
bearer_auth
|
str
|
The bearer authentication to use for the request. |
...
|
basic_auth
|
Tuple[str, str | None]
|
The basic authentication to use for the request. |
...
|
query
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The query parameters to use for the request. |
...
|
form
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The form parameters to use for the request. |
...
|
json
|
Any
|
The JSON body to use for the request. |
...
|
body
|
str | bytes | Sequence[Tuple[str, str]] | Tuple[str, str | int | float | bool] | Mapping[str, str | int | float | bool] | Any | Generator[bytes, str, None] | AsyncGenerator[bytes, str]
|
The body to use for the request. |
...
|
multipart
|
Multipart
|
The multipart form to use for the request. |
...
|
Source code in python/wreq/blocking.py
patch
patch(url, *, emulation=..., headers=..., orig_headers=..., default_headers=..., cookies=..., proxy=..., local_address=..., local_addresses=..., interface=..., timeout=..., read_timeout=..., version=..., redirect=..., cookie_provider=..., gzip=..., brotli=..., deflate=..., zstd=..., auth=..., bearer_auth=..., basic_auth=..., query=..., form=..., json=..., body=..., multipart=...)
Shortcut method to quickly make a request.
Examples
import wreq
import wreq.blocking
response = wreq.blocking.patch("https://httpbin.io/anything", json={"key": "value"})
print(response.text())
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emulation
|
Emulation | Profile
|
The Emulation settings for the request. |
...
|
headers
|
Mapping[str, str] | HeaderMap
|
The headers to use for the request. |
...
|
orig_headers
|
Sequence[str] | OrigHeaderMap
|
The original headers to use for the request. |
...
|
default_headers
|
bool
|
The option enables default headers. |
...
|
cookies
|
str | Mapping[str, str]
|
The cookies to use for the request. |
...
|
proxy
|
Proxy
|
The proxy to use for the request. |
...
|
local_address
|
IPv4Address | IPv6Address
|
Bind to a local IP Address. |
...
|
local_addresses
|
Tuple[IPv4Address | None, IPv6Address | None]
|
Bind to dual-stack local IP Addresses. |
...
|
interface
|
str
|
Bind connections only on the specified network interface. This option is only available on the following operating systems:
On Android, Linux, and Fuchsia, this uses the
Note that connections will fail if the provided interface name is not a network interface that currently exists when a connection is established. |
...
|
timeout
|
timedelta
|
The timeout to use for the request. |
...
|
read_timeout
|
timedelta
|
The read timeout to use for the request. |
...
|
version
|
Version
|
The HTTP version to use for the request. |
...
|
redirect
|
Policy
|
The redirect policy. |
...
|
cookie_provider
|
Jar
|
Set cookie provider for the request. |
...
|
gzip
|
bool
|
Sets gzip as an accepted encoding. |
...
|
brotli
|
bool
|
Sets brotli as an accepted encoding. |
...
|
deflate
|
bool
|
Sets deflate as an accepted encoding. |
...
|
zstd
|
bool
|
Sets zstd as an accepted encoding. |
...
|
auth
|
str
|
The authentication to use for the request. |
...
|
bearer_auth
|
str
|
The bearer authentication to use for the request. |
...
|
basic_auth
|
Tuple[str, str | None]
|
The basic authentication to use for the request. |
...
|
query
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The query parameters to use for the request. |
...
|
form
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The form parameters to use for the request. |
...
|
json
|
Any
|
The JSON body to use for the request. |
...
|
body
|
str | bytes | Sequence[Tuple[str, str]] | Tuple[str, str | int | float | bool] | Mapping[str, str | int | float | bool] | Any | Generator[bytes, str, None] | AsyncGenerator[bytes, str]
|
The body to use for the request. |
...
|
multipart
|
Multipart
|
The multipart form to use for the request. |
...
|
Source code in python/wreq/blocking.py
post
post(url, *, emulation=..., headers=..., orig_headers=..., default_headers=..., cookies=..., proxy=..., local_address=..., local_addresses=..., interface=..., timeout=..., read_timeout=..., version=..., redirect=..., cookie_provider=..., gzip=..., brotli=..., deflate=..., zstd=..., auth=..., bearer_auth=..., basic_auth=..., query=..., form=..., json=..., body=..., multipart=...)
Shortcut method to quickly make a request.
Examples
import wreq
import wreq.blocking
response = wreq.blocking.post("https://httpbin.io/anything", json={"key": "value"})
print(response.text())
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emulation
|
Emulation | Profile
|
The Emulation settings for the request. |
...
|
headers
|
Mapping[str, str] | HeaderMap
|
The headers to use for the request. |
...
|
orig_headers
|
Sequence[str] | OrigHeaderMap
|
The original headers to use for the request. |
...
|
default_headers
|
bool
|
The option enables default headers. |
...
|
cookies
|
str | Mapping[str, str]
|
The cookies to use for the request. |
...
|
proxy
|
Proxy
|
The proxy to use for the request. |
...
|
local_address
|
IPv4Address | IPv6Address
|
Bind to a local IP Address. |
...
|
local_addresses
|
Tuple[IPv4Address | None, IPv6Address | None]
|
Bind to dual-stack local IP Addresses. |
...
|
interface
|
str
|
Bind connections only on the specified network interface. This option is only available on the following operating systems:
On Android, Linux, and Fuchsia, this uses the
Note that connections will fail if the provided interface name is not a network interface that currently exists when a connection is established. |
...
|
timeout
|
timedelta
|
The timeout to use for the request. |
...
|
read_timeout
|
timedelta
|
The read timeout to use for the request. |
...
|
version
|
Version
|
The HTTP version to use for the request. |
...
|
redirect
|
Policy
|
The redirect policy. |
...
|
cookie_provider
|
Jar
|
Set cookie provider for the request. |
...
|
gzip
|
bool
|
Sets gzip as an accepted encoding. |
...
|
brotli
|
bool
|
Sets brotli as an accepted encoding. |
...
|
deflate
|
bool
|
Sets deflate as an accepted encoding. |
...
|
zstd
|
bool
|
Sets zstd as an accepted encoding. |
...
|
auth
|
str
|
The authentication to use for the request. |
...
|
bearer_auth
|
str
|
The bearer authentication to use for the request. |
...
|
basic_auth
|
Tuple[str, str | None]
|
The basic authentication to use for the request. |
...
|
query
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The query parameters to use for the request. |
...
|
form
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The form parameters to use for the request. |
...
|
json
|
Any
|
The JSON body to use for the request. |
...
|
body
|
str | bytes | Sequence[Tuple[str, str]] | Tuple[str, str | int | float | bool] | Mapping[str, str | int | float | bool] | Any | Generator[bytes, str, None] | AsyncGenerator[bytes, str]
|
The body to use for the request. |
...
|
multipart
|
Multipart
|
The multipart form to use for the request. |
...
|
Source code in python/wreq/blocking.py
put
put(url, *, emulation=..., headers=..., orig_headers=..., default_headers=..., cookies=..., proxy=..., local_address=..., local_addresses=..., interface=..., timeout=..., read_timeout=..., version=..., redirect=..., cookie_provider=..., gzip=..., brotli=..., deflate=..., zstd=..., auth=..., bearer_auth=..., basic_auth=..., query=..., form=..., json=..., body=..., multipart=...)
Shortcut method to quickly make a request.
Examples
import wreq
import wreq.blocking
response = wreq.blocking.put("https://httpbin.io/anything", json={"key": "value"})
print(response.text())
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emulation
|
Emulation | Profile
|
The Emulation settings for the request. |
...
|
headers
|
Mapping[str, str] | HeaderMap
|
The headers to use for the request. |
...
|
orig_headers
|
Sequence[str] | OrigHeaderMap
|
The original headers to use for the request. |
...
|
default_headers
|
bool
|
The option enables default headers. |
...
|
cookies
|
str | Mapping[str, str]
|
The cookies to use for the request. |
...
|
proxy
|
Proxy
|
The proxy to use for the request. |
...
|
local_address
|
IPv4Address | IPv6Address
|
Bind to a local IP Address. |
...
|
local_addresses
|
Tuple[IPv4Address | None, IPv6Address | None]
|
Bind to dual-stack local IP Addresses. |
...
|
interface
|
str
|
Bind connections only on the specified network interface. This option is only available on the following operating systems:
On Android, Linux, and Fuchsia, this uses the
Note that connections will fail if the provided interface name is not a network interface that currently exists when a connection is established. |
...
|
timeout
|
timedelta
|
The timeout to use for the request. |
...
|
read_timeout
|
timedelta
|
The read timeout to use for the request. |
...
|
version
|
Version
|
The HTTP version to use for the request. |
...
|
redirect
|
Policy
|
The redirect policy. |
...
|
cookie_provider
|
Jar
|
Set cookie provider for the request. |
...
|
gzip
|
bool
|
Sets gzip as an accepted encoding. |
...
|
brotli
|
bool
|
Sets brotli as an accepted encoding. |
...
|
deflate
|
bool
|
Sets deflate as an accepted encoding. |
...
|
zstd
|
bool
|
Sets zstd as an accepted encoding. |
...
|
auth
|
str
|
The authentication to use for the request. |
...
|
bearer_auth
|
str
|
The bearer authentication to use for the request. |
...
|
basic_auth
|
Tuple[str, str | None]
|
The basic authentication to use for the request. |
...
|
query
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The query parameters to use for the request. |
...
|
form
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The form parameters to use for the request. |
...
|
json
|
Any
|
The JSON body to use for the request. |
...
|
body
|
str | bytes | Sequence[Tuple[str, str]] | Tuple[str, str | int | float | bool] | Mapping[str, str | int | float | bool] | Any | Generator[bytes, str, None] | AsyncGenerator[bytes, str]
|
The body to use for the request. |
...
|
multipart
|
Multipart
|
The multipart form to use for the request. |
...
|
Source code in python/wreq/blocking.py
request
request(method, url, *, emulation=..., headers=..., orig_headers=..., default_headers=..., cookies=..., proxy=..., local_address=..., local_addresses=..., interface=..., timeout=..., read_timeout=..., version=..., redirect=..., cookie_provider=..., gzip=..., brotli=..., deflate=..., zstd=..., auth=..., bearer_auth=..., basic_auth=..., query=..., form=..., json=..., body=..., multipart=...)
Make a request with the given parameters.
Arguments
method- The method to use for the request.url- The URL to send the request to.**kwargs- Additional request parameters.
Examples
import wreq
import wreq.blocking
from wreq import Method
response = wreq.blocking.request(Method.GET, "https://www.rust-lang.org")
print(response.text())
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emulation
|
Emulation | Profile
|
The Emulation settings for the request. |
...
|
headers
|
Mapping[str, str] | HeaderMap
|
The headers to use for the request. |
...
|
orig_headers
|
Sequence[str] | OrigHeaderMap
|
The original headers to use for the request. |
...
|
default_headers
|
bool
|
The option enables default headers. |
...
|
cookies
|
str | Mapping[str, str]
|
The cookies to use for the request. |
...
|
proxy
|
Proxy
|
The proxy to use for the request. |
...
|
local_address
|
IPv4Address | IPv6Address
|
Bind to a local IP Address. |
...
|
local_addresses
|
Tuple[IPv4Address | None, IPv6Address | None]
|
Bind to dual-stack local IP Addresses. |
...
|
interface
|
str
|
Bind connections only on the specified network interface. This option is only available on the following operating systems:
On Android, Linux, and Fuchsia, this uses the
Note that connections will fail if the provided interface name is not a network interface that currently exists when a connection is established. |
...
|
timeout
|
timedelta
|
The timeout to use for the request. |
...
|
read_timeout
|
timedelta
|
The read timeout to use for the request. |
...
|
version
|
Version
|
The HTTP version to use for the request. |
...
|
redirect
|
Policy
|
The redirect policy. |
...
|
cookie_provider
|
Jar
|
Set cookie provider for the request. |
...
|
gzip
|
bool
|
Sets gzip as an accepted encoding. |
...
|
brotli
|
bool
|
Sets brotli as an accepted encoding. |
...
|
deflate
|
bool
|
Sets deflate as an accepted encoding. |
...
|
zstd
|
bool
|
Sets zstd as an accepted encoding. |
...
|
auth
|
str
|
The authentication to use for the request. |
...
|
bearer_auth
|
str
|
The bearer authentication to use for the request. |
...
|
basic_auth
|
Tuple[str, str | None]
|
The basic authentication to use for the request. |
...
|
query
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The query parameters to use for the request. |
...
|
form
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The form parameters to use for the request. |
...
|
json
|
Any
|
The JSON body to use for the request. |
...
|
body
|
str | bytes | Sequence[Tuple[str, str]] | Tuple[str, str | int | float | bool] | Mapping[str, str | int | float | bool] | Any | Generator[bytes, str, None] | AsyncGenerator[bytes, str]
|
The body to use for the request. |
...
|
multipart
|
Multipart
|
The multipart form to use for the request. |
...
|
Source code in python/wreq/blocking.py
trace
trace(url, *, emulation=..., headers=..., orig_headers=..., default_headers=..., cookies=..., proxy=..., local_address=..., local_addresses=..., interface=..., timeout=..., read_timeout=..., version=..., redirect=..., cookie_provider=..., gzip=..., brotli=..., deflate=..., zstd=..., auth=..., bearer_auth=..., basic_auth=..., query=..., form=..., json=..., body=..., multipart=...)
Shortcut method to quickly make a request.
Examples
import wreq
import wreq.blocking
response = wreq.blocking.trace("https://httpbin.io/anything")
print(response.status)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emulation
|
Emulation | Profile
|
The Emulation settings for the request. |
...
|
headers
|
Mapping[str, str] | HeaderMap
|
The headers to use for the request. |
...
|
orig_headers
|
Sequence[str] | OrigHeaderMap
|
The original headers to use for the request. |
...
|
default_headers
|
bool
|
The option enables default headers. |
...
|
cookies
|
str | Mapping[str, str]
|
The cookies to use for the request. |
...
|
proxy
|
Proxy
|
The proxy to use for the request. |
...
|
local_address
|
IPv4Address | IPv6Address
|
Bind to a local IP Address. |
...
|
local_addresses
|
Tuple[IPv4Address | None, IPv6Address | None]
|
Bind to dual-stack local IP Addresses. |
...
|
interface
|
str
|
Bind connections only on the specified network interface. This option is only available on the following operating systems:
On Android, Linux, and Fuchsia, this uses the
Note that connections will fail if the provided interface name is not a network interface that currently exists when a connection is established. |
...
|
timeout
|
timedelta
|
The timeout to use for the request. |
...
|
read_timeout
|
timedelta
|
The read timeout to use for the request. |
...
|
version
|
Version
|
The HTTP version to use for the request. |
...
|
redirect
|
Policy
|
The redirect policy. |
...
|
cookie_provider
|
Jar
|
Set cookie provider for the request. |
...
|
gzip
|
bool
|
Sets gzip as an accepted encoding. |
...
|
brotli
|
bool
|
Sets brotli as an accepted encoding. |
...
|
deflate
|
bool
|
Sets deflate as an accepted encoding. |
...
|
zstd
|
bool
|
Sets zstd as an accepted encoding. |
...
|
auth
|
str
|
The authentication to use for the request. |
...
|
bearer_auth
|
str
|
The bearer authentication to use for the request. |
...
|
basic_auth
|
Tuple[str, str | None]
|
The basic authentication to use for the request. |
...
|
query
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The query parameters to use for the request. |
...
|
form
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The form parameters to use for the request. |
...
|
json
|
Any
|
The JSON body to use for the request. |
...
|
body
|
str | bytes | Sequence[Tuple[str, str]] | Tuple[str, str | int | float | bool] | Mapping[str, str | int | float | bool] | Any | Generator[bytes, str, None] | AsyncGenerator[bytes, str]
|
The body to use for the request. |
...
|
multipart
|
Multipart
|
The multipart form to use for the request. |
...
|
Source code in python/wreq/blocking.py
websocket
websocket(url, *, emulation=..., proxy=..., local_address=..., local_addresses=..., interface=..., headers=..., orig_headers=..., default_headers=..., cookies=..., protocols=..., version=..., auth=..., bearer_auth=..., basic_auth=..., query=..., read_buffer_size=..., write_buffer_size=..., max_write_buffer_size=..., max_message_size=..., max_frame_size=..., accept_unmasked_frames=...)
Make a WebSocket connection with the given parameters.
Examples
import wreq
import wreq.blocking
ws = wreq.blocking.websocket("wss://echo.websocket.org")
ws.send(wreq.Message.from_text("Hello, World!"))
message = ws.recv()
print("Received:", message.data)
ws.close()
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emulation
|
Emulation | Profile
|
The Emulation settings for the request. |
...
|
proxy
|
Proxy
|
The proxy to use for the request. |
...
|
local_address
|
IPv4Address | IPv6Address
|
Bind to a local IP Address. |
...
|
local_addresses
|
Tuple[IPv4Address | None, IPv6Address | None]
|
Bind to dual-stack local IP Addresses. |
...
|
interface
|
str
|
Bind to an interface by SO_BINDTODEVICE. |
...
|
headers
|
Mapping[str, str] | HeaderMap
|
The headers to use for the request. |
...
|
orig_headers
|
Sequence[str] | OrigHeaderMap
|
The original headers to use for the request. |
...
|
default_headers
|
bool
|
The option enables default headers. |
...
|
cookies
|
str | Mapping[str, str]
|
The cookies to use for the request. |
...
|
protocols
|
Sequence[str]
|
The protocols to use for the request. |
...
|
version
|
Version
|
The HTTP version to use for the request. |
...
|
auth
|
str
|
The authentication to use for the request. |
...
|
bearer_auth
|
str
|
The bearer authentication to use for the request. |
...
|
basic_auth
|
Tuple[str, str | None]
|
The basic authentication to use for the request. |
...
|
query
|
Sequence[Tuple[str, str | int | float | bool]] | Mapping[str, str | int | float | bool]
|
The query parameters to use for the request. |
...
|
read_buffer_size
|
int
|
Read buffer capacity. This buffer is eagerly allocated and used for receiving messages. For high read load scenarios a larger buffer, e.g. 128 KiB, improves performance. For scenarios where you expect a lot of connections and don't need high read load performance a smaller buffer, e.g. 4 KiB, would be appropriate to lower total memory usage. The default value is 128 KiB. |
...
|
write_buffer_size
|
int
|
The target minimum size of the write buffer to reach before writing the data to the underlying stream. The default value is 128 KiB. If set to 0 each message will be eagerly written to the underlying stream. It is often more optimal to allow them to buffer a little, hence the default value. Note: flush() will always fully write the buffer regardless. |
...
|
max_write_buffer_size
|
int
|
The max size of the write buffer in bytes. Setting this can provide backpressure in the case the write buffer is filling up due to write errors. The default value is unlimited. Note: The write buffer only builds up past write_buffer_size when writes to the underlying stream are failing. So the write buffer can not fill up if you are not observing write errors even if not flushing. Note: Should always be at least write_buffer_size + 1 message and probably a little more depending on error handling strategy. |
...
|
max_message_size
|
int
|
The maximum size of an incoming message. None means no size limit. The default value is 64 MiB which should be reasonably big for all normal use-cases but small enough to prevent memory eating by a malicious user. |
...
|
max_frame_size
|
int
|
The maximum size of a single incoming message frame. None means no size limit. The limit is for frame payload NOT including the frame header. The default value is 16 MiB which should be reasonably big for all normal use-cases but small enough to prevent memory eating by a malicious user. |
...
|
accept_unmasked_frames
|
bool
|
When set to True, the server will accept and handle unmasked frames from the client. According to RFC 6455, the server must close the connection to the client in such cases, however it seems like there are some popular libraries that are sending unmasked frames, ignoring the RFC. By default this option is set to False, i.e. according to RFC6455. |
...
|