pyrequests

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 26 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CertificateVerifyFailed

func CertificateVerifyFailed(err error) bool

Whether a TLS failure is a certificate the client refused, every chain, name and validity check the handshake runs

func EnvCABundle

func EnvCABundle() string

Verify bundle requests merges from the environment, REQUESTS_CA_BUNDLE then CURL_CA_BUNDLE, empty keeping the default

func PathURL

func PathURL(u *url.URL) string

PathURL is PreparedRequest.path_url, the path with its query and a slash for an empty path

func SSLErrorText

func SSLErrorText(err error) string

str of the ssl module exception a failed handshake raises, the strerror its repr carries

func VerifyTLSConfig

func VerifyTLSConfig(base *tls.Config, bundle string, dir bool) *tls.Config

TLS config verifying with a bundle file or hashed capath directory on top of the roots base trusts, an unusable file failing every handshake with its load error

Types

type Error

type Error struct {
	Class string
	Text  string
	// Reason is the urllib3 class under a MaxRetryError and DNS marks a name resolution cause
	Reason string
	DNS    bool
	Err    error
}

Error is a raised requests exception, Class its class name and Text its str

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type OSError

type OSError struct{ Text string }

OSError is an OSError requests raises itself, outside the RequestException family its callers catch

func (*OSError) Error

func (e *OSError) Error() string

func (*OSError) PyTypeName

func (e *OSError) PyTypeName() string

Python exception class name the error stands for

type Response

type Response struct {
	Status int
	Header http.Header
	Body   []byte
	// Final URL after redirects, the url raise_for_status names
	URL string
}

Response is one answer read whole

func Send

func Send(ctx context.Context, base *http.Transport, t Timeout, req *http.Request) (*Response, error)

Send performs one requests call, every transport failure raised as the requests exception it maps to

func SendNoEnv

func SendNoEnv(ctx context.Context, base *http.Transport, t Timeout, req *http.Request) (*Response, error)

SendNoEnv is Send for a client that is not a requests session trusting its environment, the verify bundle variables left unread

func SendNoRedirects

func SendNoRedirects(ctx context.Context, base *http.Transport, t Timeout, req *http.Request) (*Response, error)

SendNoRedirects is Send with allow_redirects False, a redirect answer returned as the response

func (*Response) RaiseForStatus

func (r *Response) RaiseForStatus(rawURL string) error

HTTPError requests raise_for_status raises for a client or server error status, nil for any other

type Timeout

type Timeout struct {
	Connect, Read         time.Duration
	ConnectText, ReadText string
}

Timeout is a requests timeout, each limit with the Python str of the value passed

func Seconds

func Seconds(v any) Timeout

Seconds is the timeout requests builds from timeout=v for an int or float v

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL