Skip to content

Base Models

Internal API

These classes are for internal use only.

Users should interact with Client and other public API classes instead.


JsonQuery


json_query

logger = logging.getLogger('scurrypy.json_query') module-attribute

JsonQuery

Discord payload traversal utility.

Parameters:

  • payload (JSON | list[JSON]) –

    Discord payload

payload = payload instance-attribute

Discord payload.

value: Any = None instance-attribute

Queried value.

get

Traverse data with path.

Parameters:

  • path (str) –

    dot-separated key path to value

  • t (Any, default: None ) –

    type value should be (leave blank to return query unchanged)

Returns:

  • Self –

    new JsonQuery instance with queried data

pprint

Pretty print value!

Returns:

  • Self –

    self

Part


part

Part dataclass

Part is a base class that serializes a dataclass into a JSON.

serialize

Serialize the value.

Parameters:

  • val (dict) –

    value to serialize

Returns:

  • JSON –

    serialized value

is_nullable_field

Determines whether the specified field is of type OptionalNullablePartField.

Parameters:

  • field (Field) –

    dataclass field

Returns:

  • bool ( bool ) –

    whether field is optional and nullable

BaseResource


BaseResource dataclass

Represents a Discord resource.

http: HttpClient instance-attribute

HTTP session for requests.