Skip to main content

Language grade: Python PyPI

Marriage of Pydantic and Requests

A helper that integrates Pydantic with requests library for seamless access to defined Models.

Example

from enum import Enum
from pydantic import BaseModel
from pydantic_requests import PydanticSession


class DNSStatus(Enum):
    """DNS OP response codes.
    ref: https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-6
    """

    # No Error = 0
    NoError = 0

    # Format Error = 1
    FormErr = 1

    # Server Failure
    ServFail = 2

    # Non-Existent Domain
    NXDomain = 3


class DNSQuery(BaseModel):
    Status: DNSStatus

    class Config:
        """Configure DNS query."""

        allow_mutation = False
        arbitrary_types_allowed = True


with PydanticSession(
    {200: DNSQuery}, headers={"accept": "application/dns-json"}
) as session:
    domain = "dz0ny.xyz"
    res = session.get(
        "https://cloudflare-dns.com/dns-query", params={"name": domain, "type": "NS"}
    )
    res.raise_for_status()
    query: DNSQuery = res.model
    if query.Status == DNSStatus.NXDomain:
        print("Domain is not registered.")
    else:
        print("Domain is registered.")

Metadata

Release files for pydantic-requests 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydantic-requests 0.1.4
File Size Uploaded Provenance Actions
pydantic-requests-0.1.4.tar.gz 3.4 kB Without provenance Details for pydantic-requests-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pydantic-requests 0.1.4
File Interpreter ABI Platform Actions
pydantic_requests-0.1.4-py3-none-any.whl Python 3 none any Details for pydantic_requests-0.1.4-py3-none-any.whl

Total release size: 6.8 kB

Release files / pydantic-requests-0.1.4.tar.gz

Download URL pydantic-requests-0.1.4.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
893ed9111f29bd45bd2ee62adde44f32958061541605e918844d6b2404aef884
BLAKE2b-256 checksum
How to use checksums
1161f28e17ca58a9ab39ae24e22816fed8573e43cbcc4393d23952a703b04b7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.9.10 Darwin/21.4.0

Release files / pydantic_requests-0.1.4-py3-none-any.whl

Download URL pydantic_requests-0.1.4-py3-none-any.whl
Size 3.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
526340e0525fd5c7ad995b8335db6e3ea16fa5b8815f028ce6531887f6b1d117
BLAKE2b-256 checksum
How to use checksums
6e82cf1a4359708b0c1c4984ff3bbc7fd26ba8d88f5c27e937280b1c56683589
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.9.10 Darwin/21.4.0

Security for pydantic-requests 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page