OAuth2 token

OAuth2.0 refresh token middleware.

class blacksmith.middleware._async.oauth2_token.GetToken(*, content_type: str = 'application/x-www-form-urlencoded', client_id: str | UUID, client_secret: SecretStr, grant_type: Literal['refresh_token'], refresh_token: SecretStr)
content_type: str
client_id: str | UUID
client_secret: SecretStr
grant_type: Literal['refresh_token']
refresh_token: SecretStr
__pydantic_fields_set__

The names of fields explicitly set during instantiation.

__pydantic_extra__

A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.

__pydantic_private__

Values of private attributes set on the model instance.

__class_vars__ = {}

The names of the class variables defined on the model.

__private_attributes__ = {}

Metadata about the private attributes of the model.

__pydantic_complete__ = True

Whether model building is completed, or if there are still undefined fields.

__pydantic_computed_fields__ = {}

A dictionary of computed field names and their corresponding [ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects.

__pydantic_core_schema__ = {'cls': <class 'blacksmith.middleware._async.oauth2_token.GetToken'>, 'config': {'title': 'GetToken'}, 'custom_init': False, 'metadata': {'pydantic_js_functions': [<bound method BaseModel.__get_pydantic_json_schema__ of <class 'blacksmith.middleware._async.oauth2_token.GetToken'>>]}, 'ref': 'blacksmith.middleware._async.oauth2_token.GetToken:94831191258976', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'client_id': {'metadata': {'pydantic_js_extra': {'location': 'body'}}, 'schema': {'choices': [{'type': 'str'}, {'type': 'uuid'}], 'type': 'union'}, 'type': 'model-field'}, 'client_secret': {'metadata': {'pydantic_js_extra': {'location': 'body'}}, 'schema': {'lax_schema': {'json_schema': {'function': {'function': <class 'pydantic.types.SecretStr'>, 'type': 'no-info'}, 'schema': {'strict': False, 'type': 'str'}, 'type': 'function-after'}, 'python_schema': {'choices': [{'cls': <class 'pydantic.types.SecretStr'>, 'type': 'is-instance'}, {'function': {'function': <class 'pydantic.types.SecretStr'>, 'type': 'no-info'}, 'schema': {'strict': False, 'type': 'str'}, 'type': 'function-after'}], 'custom_error_type': 'string_type', 'type': 'union'}, 'serialization': {'function': <function _serialize_secret_field>, 'info_arg': True, 'type': 'function-plain', 'when_used': 'unless-none'}, 'type': 'json-or-python'}, 'metadata': {'pydantic_js_functions': [<function _SecretField.__get_pydantic_core_schema__.<locals>.get_json_schema>]}, 'strict_schema': {'json_schema': {'function': {'function': <class 'pydantic.types.SecretStr'>, 'type': 'no-info'}, 'schema': {'strict': True, 'type': 'str'}, 'type': 'function-after'}, 'python_schema': {'choices': [{'cls': <class 'pydantic.types.SecretStr'>, 'type': 'is-instance'}, {'function': {'function': <class 'pydantic.types.SecretStr'>, 'type': 'no-info'}, 'schema': {'strict': True, 'type': 'str'}, 'type': 'function-after'}], 'custom_error_type': 'string_type', 'type': 'union'}, 'serialization': {'function': <function _serialize_secret_field>, 'info_arg': True, 'type': 'function-plain', 'when_used': 'unless-none'}, 'type': 'json-or-python'}, 'type': 'lax-or-strict'}, 'type': 'model-field'}, 'content_type': {'metadata': {'pydantic_js_extra': {'location': 'header'}}, 'schema': {'default': 'application/x-www-form-urlencoded', 'schema': {'type': 'str'}, 'type': 'default'}, 'serialization_alias': 'Content-Type', 'type': 'model-field', 'validation_alias': 'Content-Type'}, 'grant_type': {'metadata': {'pydantic_js_extra': {'location': 'body'}}, 'schema': {'expected': ['refresh_token'], 'type': 'literal'}, 'type': 'model-field'}, 'refresh_token': {'metadata': {'pydantic_js_extra': {'location': 'body'}}, 'schema': {'lax_schema': {'json_schema': {'function': {'function': <class 'pydantic.types.SecretStr'>, 'type': 'no-info'}, 'schema': {'strict': False, 'type': 'str'}, 'type': 'function-after'}, 'python_schema': {'choices': [{'cls': <class 'pydantic.types.SecretStr'>, 'type': 'is-instance'}, {'function': {'function': <class 'pydantic.types.SecretStr'>, 'type': 'no-info'}, 'schema': {'strict': False, 'type': 'str'}, 'type': 'function-after'}], 'custom_error_type': 'string_type', 'type': 'union'}, 'serialization': {'function': <function _serialize_secret_field>, 'info_arg': True, 'type': 'function-plain', 'when_used': 'unless-none'}, 'type': 'json-or-python'}, 'metadata': {'pydantic_js_functions': [<function _SecretField.__get_pydantic_core_schema__.<locals>.get_json_schema>]}, 'strict_schema': {'json_schema': {'function': {'function': <class 'pydantic.types.SecretStr'>, 'type': 'no-info'}, 'schema': {'strict': True, 'type': 'str'}, 'type': 'function-after'}, 'python_schema': {'choices': [{'cls': <class 'pydantic.types.SecretStr'>, 'type': 'is-instance'}, {'function': {'function': <class 'pydantic.types.SecretStr'>, 'type': 'no-info'}, 'schema': {'strict': True, 'type': 'str'}, 'type': 'function-after'}], 'custom_error_type': 'string_type', 'type': 'union'}, 'serialization': {'function': <function _serialize_secret_field>, 'info_arg': True, 'type': 'function-plain', 'when_used': 'unless-none'}, 'type': 'json-or-python'}, 'type': 'lax-or-strict'}, 'type': 'model-field'}}, 'model_name': 'GetToken', 'type': 'model-fields'}, 'type': 'model'}

The core schema of the model.

__pydantic_custom_init__ = False

Whether the model has a custom __init__ method.

__pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})

Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.

__pydantic_extra_info__ = None

A wrapper around the __pydantic_extra__ annotation, if explicitly annotated on a model.

This is a private attribute, not meant to be used outside Pydantic.

__pydantic_fields__ = {'client_id': FieldInfo(annotation=Union[str, UUID], required=True, json_schema_extra={'location': 'body'}), 'client_secret': FieldInfo(annotation=SecretStr, required=True, json_schema_extra={'location': 'body'}), 'content_type': FieldInfo(annotation=str, required=False, default='application/x-www-form-urlencoded', alias='Content-Type', alias_priority=2, json_schema_extra={'location': 'header'}), 'grant_type': FieldInfo(annotation=Literal['refresh_token'], required=True, json_schema_extra={'location': 'body'}), 'refresh_token': FieldInfo(annotation=SecretStr, required=True, json_schema_extra={'location': 'body'})}

A dictionary of field names and their corresponding [FieldInfo][pydantic.fields.FieldInfo] objects. This replaces Model.__fields__ from Pydantic V1.

__pydantic_generic_metadata__ = {'args': (), 'origin': None, 'parameters': ()}

A dictionary containing metadata about generic Pydantic models.

The origin and args items map to the [__origin__][genericalias.__origin__] and [__args__][genericalias.__args__] attributes of [generic aliases][types-genericalias], and the parameter item maps to the __parameter__ attribute of generic classes.

__pydantic_parent_namespace__ = None

Parent namespace of the model, used for automatic rebuilding of models.

__pydantic_post_init__ = None

The name of the post-init method for the model, if defined.

__pydantic_serializer__ = SchemaSerializer(serializer=PolymorphismTrampoline(     PolymorphismTrampoline {         class: Py(             0x0000563f9b77f760,         ),         serializer: Model(             ModelSerializer {                 class: Py(                     0x0000563f9b77f760,                 ),                 serializer: Fields(                     GeneralFieldsSerializer {                         fields: SerFields {                             fields: [                                 SerField {                                     key: "content_type",                                     alias: Some(                                         "Content-Type",                                     ),                                     serializer: Some(                                         WithDefault(                                             WithDefaultSerializer {                                                 default: Default(                                                     Py(                                                         0x00007fd33b9ce100,                                                     ),                                                 ),                                                 serializer: Str(                                                     StrSerializer,                                                 ),                                             },                                         ),                                     ),                                     required: true,                                     serialize_by_alias: None,                                     serialization_exclude_if: None,                                 },                                 SerField {                                     key: "client_id",                                     alias: None,                                     serializer: Some(                                         Union(                                             UnionSerializer {                                                 choices: UnionChoices {                                                     choices: [                                                         Str(                                                             StrSerializer,                                                         ),                                                         Uuid(                                                             UuidSerializer,                                                         ),                                                     ],                                                 },                                                 name: "Union[str, uuid]",                                             },                                         ),                                     ),                                     required: true,                                     serialize_by_alias: None,                                     serialization_exclude_if: None,                                 },                                 SerField {                                     key: "client_secret",                                     alias: None,                                     serializer: Some(                                         Function(                                             FunctionPlainSerializer {                                                 func: Py(                                                     0x00007fd33d031800,                                                 ),                                                 name: "plain_function[_serialize_secret_field]",                                                 function_name: "_serialize_secret_field",                                                 return_serializer: Any(                                                     AnySerializer,                                                 ),                                                 fallback_serializer: Some(                                                     JsonOrPython(                                                         JsonOrPythonSerializer {                                                             json: Str(                                                                 StrSerializer,                                                             ),                                                             python: Union(                                                                 UnionSerializer {                                                                     choices: UnionChoices {                                                                         choices: [                                                                             Any(                                                                                 AnySerializer,                                                                             ),                                                                             Str(                                                                                 StrSerializer,                                                                             ),                                                                         ],                                                                     },                                                                     name: "Union[any, str]",                                                                 },                                                             ),                                                             name: "json-or-python[json=str, python=Union[any, str]]",                                                         },                                                     ),                                                 ),                                                 when_used: UnlessNone,                                                 is_field_serializer: false,                                                 info_arg: true,                                             },                                         ),                                     ),                                     required: true,                                     serialize_by_alias: None,                                     serialization_exclude_if: None,                                 },                                 SerField {                                     key: "grant_type",                                     alias: None,                                     serializer: Some(                                         Literal(                                             LiteralSerializer {                                                 expected_int: {},                                                 expected_str: {                                                     "refresh_token",                                                 },                                                 expected_py: None,                                                 name: "literal['refresh_token']",                                             },                                         ),                                     ),                                     required: true,                                     serialize_by_alias: None,                                     serialization_exclude_if: None,                                 },                                 SerField {                                     key: "refresh_token",                                     alias: None,                                     serializer: Some(                                         Function(                                             FunctionPlainSerializer {                                                 func: Py(                                                     0x00007fd33d031800,                                                 ),                                                 name: "plain_function[_serialize_secret_field]",                                                 function_name: "_serialize_secret_field",                                                 return_serializer: Any(                                                     AnySerializer,                                                 ),                                                 fallback_serializer: Some(                                                     JsonOrPython(                                                         JsonOrPythonSerializer {                                                             json: Str(                                                                 StrSerializer,                                                             ),                                                             python: Union(                                                                 UnionSerializer {                                                                     choices: UnionChoices {                                                                         choices: [                                                                             Any(                                                                                 AnySerializer,                                                                             ),                                                                             Str(                                                                                 StrSerializer,                                                                             ),                                                                         ],                                                                     },                                                                     name: "Union[any, str]",                                                                 },                                                             ),                                                             name: "json-or-python[json=str, python=Union[any, str]]",                                                         },                                                     ),                                                 ),                                                 when_used: UnlessNone,                                                 is_field_serializer: false,                                                 info_arg: true,                                             },                                         ),                                     ),                                     required: true,                                     serialize_by_alias: None,                                     serialization_exclude_if: None,                                 },                             ],                             by_name: {                                 "content_type": 0,                                 "grant_type": 3,                                 "client_id": 1,                                 "client_secret": 2,                                 "refresh_token": 4,                             },                         },                         computed_fields: Some(                             ComputedFields(                                 [],                             ),                         ),                         mode: SimpleDict,                         extra_serializer: None,                         filter: SchemaFilter {                             include: None,                             exclude: None,                         },                         required_fields: 5,                     },                 ),                 has_extra: false,                 root_model: false,                 name: "GetToken",             },         ),         enabled_from_config: false,     }, ), definitions=[])

The pydantic-core SchemaSerializer used to dump instances of the model.

__pydantic_setattr_handlers__ = {}

__setattr__ handlers. Memoizing the handlers leads to a dramatic performance improvement in __setattr__

__pydantic_validator__ = SchemaValidator(title="GetToken", validator=Model(     ModelValidator {         revalidate: Never,         validator: ModelFields(             ModelFieldsValidator {                 fields: [                     Field {                         name: "content_type",                         lookup_path_collection: LookupPathCollection {                             by_name: LookupPath {                                 first_item: PathItemString(                                     "content_type",                                 ),                                 rest: [],                             },                             by_alias: [                                 LookupPath {                                     first_item: PathItemString(                                         "Content-Type",                                     ),                                     rest: [],                                 },                             ],                         },                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x00007fd33b9ce100,                                     ),                                 ),                                 on_error: Raise,                                 validator: Str(                                     StrValidator {                                         strict: false,                                         coerce_numbers_to_str: false,                                     },                                 ),                                 validate_default: false,                                 copy_default: false,                                 name: "default[str]",                                 undefined: Py(                                     0x00007fd33d8fc740,                                 ),                             },                         ),                         frozen: false,                     },                     Field {                         name: "client_id",                         lookup_path_collection: LookupPathCollection {                             by_name: LookupPath {                                 first_item: PathItemString(                                     "client_id",                                 ),                                 rest: [],                             },                             by_alias: [],                         },                         validator: Union(                             UnionValidator {                                 mode: Smart,                                 choices: [                                     (                                         Str(                                             StrValidator {                                                 strict: false,                                                 coerce_numbers_to_str: false,                                             },                                         ),                                         None,                                     ),                                     (                                         Uuid(                                             UuidValidator {                                                 strict: false,                                                 version: None,                                             },                                         ),                                         None,                                     ),                                 ],                                 custom_error: None,                                 name: "union[str,uuid]",                             },                         ),                         frozen: false,                     },                     Field {                         name: "client_secret",                         lookup_path_collection: LookupPathCollection {                             by_name: LookupPath {                                 first_item: PathItemString(                                     "client_secret",                                 ),                                 rest: [],                             },                             by_alias: [],                         },                         validator: LaxOrStrict(                             LaxOrStrictValidator {                                 strict: false,                                 lax_validator: JsonOrPython(                                     JsonOrPython {                                         json: FunctionAfter(                                             FunctionAfterValidator {                                                 validator: Str(                                                     StrValidator {                                                         strict: false,                                                         coerce_numbers_to_str: false,                                                     },                                                 ),                                                 func: Py(                                                     0x0000563f9affdca0,                                                 ),                                                 config: Py(                                                     0x00007fd33b9e42c0,                                                 ),                                                 name: "function-after[SecretStr(), str]",                                                 field_name: None,                                                 info_arg: false,                                             },                                         ),                                         python: Union(                                             UnionValidator {                                                 mode: Smart,                                                 choices: [                                                     (                                                         IsInstance(                                                             IsInstanceValidator {                                                                 class: Py(                                                                     0x0000563f9affdca0,                                                                 ),                                                                 class_repr: "SecretStr",                                                                 name: "is-instance[SecretStr]",                                                             },                                                         ),                                                         None,                                                     ),                                                     (                                                         FunctionAfter(                                                             FunctionAfterValidator {                                                                 validator: Str(                                                                     StrValidator {                                                                         strict: false,                                                                         coerce_numbers_to_str: false,                                                                     },                                                                 ),                                                                 func: Py(                                                                     0x0000563f9affdca0,                                                                 ),                                                                 config: Py(                                                                     0x00007fd33b9e42c0,                                                                 ),                                                                 name: "function-after[SecretStr(), str]",                                                                 field_name: None,                                                                 info_arg: false,                                                             },                                                         ),                                                         None,                                                     ),                                                 ],                                                 custom_error: Some(                                                     KnownError(                                                         PydanticKnownError {                                                             error_type: StringType {                                                                 context: None,                                                             },                                                         },                                                     ),                                                 ),                                                 name: "union[is-instance[SecretStr],function-after[SecretStr(), str]]",                                             },                                         ),                                         name: "json-or-python[json=function-after[SecretStr(), str],python=union[is-instance[SecretStr],function-after[SecretStr(), str]]]",                                     },                                 ),                                 strict_validator: JsonOrPython(                                     JsonOrPython {                                         json: FunctionAfter(                                             FunctionAfterValidator {                                                 validator: Str(                                                     StrValidator {                                                         strict: true,                                                         coerce_numbers_to_str: false,                                                     },                                                 ),                                                 func: Py(                                                     0x0000563f9affdca0,                                                 ),                                                 config: Py(                                                     0x00007fd33b9e42c0,                                                 ),                                                 name: "function-after[SecretStr(), str]",                                                 field_name: None,                                                 info_arg: false,                                             },                                         ),                                         python: Union(                                             UnionValidator {                                                 mode: Smart,                                                 choices: [                                                     (                                                         IsInstance(                                                             IsInstanceValidator {                                                                 class: Py(                                                                     0x0000563f9affdca0,                                                                 ),                                                                 class_repr: "SecretStr",                                                                 name: "is-instance[SecretStr]",                                                             },                                                         ),                                                         None,                                                     ),                                                     (                                                         FunctionAfter(                                                             FunctionAfterValidator {                                                                 validator: Str(                                                                     StrValidator {                                                                         strict: true,                                                                         coerce_numbers_to_str: false,                                                                     },                                                                 ),                                                                 func: Py(                                                                     0x0000563f9affdca0,                                                                 ),                                                                 config: Py(                                                                     0x00007fd33b9e42c0,                                                                 ),                                                                 name: "function-after[SecretStr(), str]",                                                                 field_name: None,                                                                 info_arg: false,                                                             },                                                         ),                                                         None,                                                     ),                                                 ],                                                 custom_error: Some(                                                     KnownError(                                                         PydanticKnownError {                                                             error_type: StringType {                                                                 context: None,                                                             },                                                         },                                                     ),                                                 ),                                                 name: "union[is-instance[SecretStr],function-after[SecretStr(), str]]",                                             },                                         ),                                         name: "json-or-python[json=function-after[SecretStr(), str],python=union[is-instance[SecretStr],function-after[SecretStr(), str]]]",                                     },                                 ),                                 name: "lax-or-strict[lax=json-or-python[json=function-after[SecretStr(), str],python=union[is-instance[SecretStr],function-after[SecretStr(), str]]],strict=json-or-python[json=function-after[SecretStr(), str],python=union[is-instance[SecretStr],function-after[SecretStr(), str]]]]",                             },                         ),                         frozen: false,                     },                     Field {                         name: "grant_type",                         lookup_path_collection: LookupPathCollection {                             by_name: LookupPath {                                 first_item: PathItemString(                                     "grant_type",                                 ),                                 rest: [],                             },                             by_alias: [],                         },                         validator: Literal(                             LiteralValidator {                                 lookup: LiteralLookup {                                     expected_bool: None,                                     expected_int: None,                                     expected_str: Some(                                         {                                             "refresh_token": 0,                                         },                                     ),                                     expected_py_dict: None,                                     expected_py_values: None,                                     expected_py_primitives: Some(                                         Py(                                             0x00007fd33b9e4400,                                         ),                                     ),                                     values: [                                         Py(                                             0x00007fd33b9da830,                                         ),                                     ],                                 },                                 expected_repr: "'refresh_token'",                                 name: "literal['refresh_token']",                             },                         ),                         frozen: false,                     },                     Field {                         name: "refresh_token",                         lookup_path_collection: LookupPathCollection {                             by_name: LookupPath {                                 first_item: PathItemString(                                     "refresh_token",                                 ),                                 rest: [],                             },                             by_alias: [],                         },                         validator: LaxOrStrict(                             LaxOrStrictValidator {                                 strict: false,                                 lax_validator: JsonOrPython(                                     JsonOrPython {                                         json: FunctionAfter(                                             FunctionAfterValidator {                                                 validator: Str(                                                     StrValidator {                                                         strict: false,                                                         coerce_numbers_to_str: false,                                                     },                                                 ),                                                 func: Py(                                                     0x0000563f9affdca0,                                                 ),                                                 config: Py(                                                     0x00007fd33b9e42c0,                                                 ),                                                 name: "function-after[SecretStr(), str]",                                                 field_name: None,                                                 info_arg: false,                                             },                                         ),                                         python: Union(                                             UnionValidator {                                                 mode: Smart,                                                 choices: [                                                     (                                                         IsInstance(                                                             IsInstanceValidator {                                                                 class: Py(                                                                     0x0000563f9affdca0,                                                                 ),                                                                 class_repr: "SecretStr",                                                                 name: "is-instance[SecretStr]",                                                             },                                                         ),                                                         None,                                                     ),                                                     (                                                         FunctionAfter(                                                             FunctionAfterValidator {                                                                 validator: Str(                                                                     StrValidator {                                                                         strict: false,                                                                         coerce_numbers_to_str: false,                                                                     },                                                                 ),                                                                 func: Py(                                                                     0x0000563f9affdca0,                                                                 ),                                                                 config: Py(                                                                     0x00007fd33b9e42c0,                                                                 ),                                                                 name: "function-after[SecretStr(), str]",                                                                 field_name: None,                                                                 info_arg: false,                                                             },                                                         ),                                                         None,                                                     ),                                                 ],                                                 custom_error: Some(                                                     KnownError(                                                         PydanticKnownError {                                                             error_type: StringType {                                                                 context: None,                                                             },                                                         },                                                     ),                                                 ),                                                 name: "union[is-instance[SecretStr],function-after[SecretStr(), str]]",                                             },                                         ),                                         name: "json-or-python[json=function-after[SecretStr(), str],python=union[is-instance[SecretStr],function-after[SecretStr(), str]]]",                                     },                                 ),                                 strict_validator: JsonOrPython(                                     JsonOrPython {                                         json: FunctionAfter(                                             FunctionAfterValidator {                                                 validator: Str(                                                     StrValidator {                                                         strict: true,                                                         coerce_numbers_to_str: false,                                                     },                                                 ),                                                 func: Py(                                                     0x0000563f9affdca0,                                                 ),                                                 config: Py(                                                     0x00007fd33b9e42c0,                                                 ),                                                 name: "function-after[SecretStr(), str]",                                                 field_name: None,                                                 info_arg: false,                                             },                                         ),                                         python: Union(                                             UnionValidator {                                                 mode: Smart,                                                 choices: [                                                     (                                                         IsInstance(                                                             IsInstanceValidator {                                                                 class: Py(                                                                     0x0000563f9affdca0,                                                                 ),                                                                 class_repr: "SecretStr",                                                                 name: "is-instance[SecretStr]",                                                             },                                                         ),                                                         None,                                                     ),                                                     (                                                         FunctionAfter(                                                             FunctionAfterValidator {                                                                 validator: Str(                                                                     StrValidator {                                                                         strict: true,                                                                         coerce_numbers_to_str: false,                                                                     },                                                                 ),                                                                 func: Py(                                                                     0x0000563f9affdca0,                                                                 ),                                                                 config: Py(                                                                     0x00007fd33b9e42c0,                                                                 ),                                                                 name: "function-after[SecretStr(), str]",                                                                 field_name: None,                                                                 info_arg: false,                                                             },                                                         ),                                                         None,                                                     ),                                                 ],                                                 custom_error: Some(                                                     KnownError(                                                         PydanticKnownError {                                                             error_type: StringType {                                                                 context: None,                                                             },                                                         },                                                     ),                                                 ),                                                 name: "union[is-instance[SecretStr],function-after[SecretStr(), str]]",                                             },                                         ),                                         name: "json-or-python[json=function-after[SecretStr(), str],python=union[is-instance[SecretStr],function-after[SecretStr(), str]]]",                                     },                                 ),                                 name: "lax-or-strict[lax=json-or-python[json=function-after[SecretStr(), str],python=union[is-instance[SecretStr],function-after[SecretStr(), str]]],strict=json-or-python[json=function-after[SecretStr(), str],python=union[is-instance[SecretStr],function-after[SecretStr(), str]]]]",                             },                         ),                         frozen: false,                     },                 ],                 model_name: "GetToken",                 extra_behavior: Ignore,                 extras_validator: None,                 extras_keys_validator: None,                 strict: false,                 from_attributes: false,                 loc_by_alias: true,                 lookup: Flat(                     FlatLookup {                         inner: {                             PathItemString(                                 "client_secret",                             ): [                                 LookupFieldInfo {                                     field_index: 2,                                     lookup_priority: LookupFieldPriority {                                         lookup_type: Both,                                         alias_index: 0,                                     },                                 },                             ],                             PathItemString(                                 "client_id",                             ): [                                 LookupFieldInfo {                                     field_index: 1,                                     lookup_priority: LookupFieldPriority {                                         lookup_type: Both,                                         alias_index: 0,                                     },                                 },                             ],                             PathItemString(                                 "grant_type",                             ): [                                 LookupFieldInfo {                                     field_index: 3,                                     lookup_priority: LookupFieldPriority {                                         lookup_type: Both,                                         alias_index: 0,                                     },                                 },                             ],                             PathItemString(                                 "refresh_token",                             ): [                                 LookupFieldInfo {                                     field_index: 4,                                     lookup_priority: LookupFieldPriority {                                         lookup_type: Both,                                         alias_index: 0,                                     },                                 },                             ],                             PathItemString(                                 "Content-Type",                             ): [                                 LookupFieldInfo {                                     field_index: 0,                                     lookup_priority: LookupFieldPriority {                                         lookup_type: Alias,                                         alias_index: 0,                                     },                                 },                             ],                             PathItemString(                                 "content_type",                             ): [                                 LookupFieldInfo {                                     field_index: 0,                                     lookup_priority: LookupFieldPriority {                                         lookup_type: Name,                                         alias_index: 0,                                     },                                 },                             ],                         },                     },                 ),                 validate_by_alias: None,                 validate_by_name: None,             },         ),         class: Py(             0x0000563f9b77f760,         ),         generic_origin: None,         post_init: None,         frozen: false,         custom_init: false,         root_model: false,         undefined: Py(             0x00007fd33d8fc740,         ),         name: "GetToken",     }, ), definitions=[], cache_strings=True)

The pydantic-core SchemaValidator used to validate instances of the model.

__signature__ = <Signature (*, content_type: str = 'application/x-www-form-urlencoded', client_id: str | uuid.UUID, client_secret: pydantic.types.SecretStr, grant_type: Literal['refresh_token'], refresh_token: pydantic.types.SecretStr) -> None>

The synthesized __init__ [Signature][inspect.Signature] of the model.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class blacksmith.middleware._async.oauth2_token.Token(*, expires_in: int, access_token: SecretStr, refresh_token: SecretStr | None = None)
expires_in: int
access_token: SecretStr
refresh_token: SecretStr | None
__pydantic_fields_set__

The names of fields explicitly set during instantiation.

__pydantic_extra__

A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.

__pydantic_private__

Values of private attributes set on the model instance.

__class_vars__ = {}

The names of the class variables defined on the model.

__private_attributes__ = {}

Metadata about the private attributes of the model.

__pydantic_complete__ = True

Whether model building is completed, or if there are still undefined fields.

__pydantic_computed_fields__ = {}

A dictionary of computed field names and their corresponding [ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects.

__pydantic_core_schema__ = {'cls': <class 'blacksmith.middleware._async.oauth2_token.Token'>, 'config': {'title': 'Token'}, 'custom_init': False, 'metadata': {'pydantic_js_functions': [<bound method BaseModel.__get_pydantic_json_schema__ of <class 'blacksmith.middleware._async.oauth2_token.Token'>>]}, 'ref': 'blacksmith.middleware._async.oauth2_token.Token:94831190199184', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'access_token': {'metadata': {}, 'schema': {'lax_schema': {'json_schema': {'function': {'function': <class 'pydantic.types.SecretStr'>, 'type': 'no-info'}, 'schema': {'strict': False, 'type': 'str'}, 'type': 'function-after'}, 'python_schema': {'choices': [{'cls': <class 'pydantic.types.SecretStr'>, 'type': 'is-instance'}, {'function': {'function': <class 'pydantic.types.SecretStr'>, 'type': 'no-info'}, 'schema': {'strict': False, 'type': 'str'}, 'type': 'function-after'}], 'custom_error_type': 'string_type', 'type': 'union'}, 'serialization': {'function': <function _serialize_secret_field>, 'info_arg': True, 'type': 'function-plain', 'when_used': 'unless-none'}, 'type': 'json-or-python'}, 'metadata': {'pydantic_js_functions': [<function _SecretField.__get_pydantic_core_schema__.<locals>.get_json_schema>]}, 'strict_schema': {'json_schema': {'function': {'function': <class 'pydantic.types.SecretStr'>, 'type': 'no-info'}, 'schema': {'strict': True, 'type': 'str'}, 'type': 'function-after'}, 'python_schema': {'choices': [{'cls': <class 'pydantic.types.SecretStr'>, 'type': 'is-instance'}, {'function': {'function': <class 'pydantic.types.SecretStr'>, 'type': 'no-info'}, 'schema': {'strict': True, 'type': 'str'}, 'type': 'function-after'}], 'custom_error_type': 'string_type', 'type': 'union'}, 'serialization': {'function': <function _serialize_secret_field>, 'info_arg': True, 'type': 'function-plain', 'when_used': 'unless-none'}, 'type': 'json-or-python'}, 'type': 'lax-or-strict'}, 'type': 'model-field'}, 'expires_in': {'metadata': {}, 'schema': {'type': 'int'}, 'type': 'model-field'}, 'refresh_token': {'metadata': {}, 'schema': {'default': None, 'schema': {'schema': {'lax_schema': {'json_schema': {'function': {'function': <class 'pydantic.types.SecretStr'>, 'type': 'no-info'}, 'schema': {'strict': False, 'type': 'str'}, 'type': 'function-after'}, 'python_schema': {'choices': [{'cls': <class 'pydantic.types.SecretStr'>, 'type': 'is-instance'}, {'function': {'function': <class 'pydantic.types.SecretStr'>, 'type': 'no-info'}, 'schema': {'strict': False, 'type': 'str'}, 'type': 'function-after'}], 'custom_error_type': 'string_type', 'type': 'union'}, 'serialization': {'function': <function _serialize_secret_field>, 'info_arg': True, 'type': 'function-plain', 'when_used': 'unless-none'}, 'type': 'json-or-python'}, 'metadata': {'pydantic_js_functions': [<function _SecretField.__get_pydantic_core_schema__.<locals>.get_json_schema>]}, 'strict_schema': {'json_schema': {'function': {'function': <class 'pydantic.types.SecretStr'>, 'type': 'no-info'}, 'schema': {'strict': True, 'type': 'str'}, 'type': 'function-after'}, 'python_schema': {'choices': [{'cls': <class 'pydantic.types.SecretStr'>, 'type': 'is-instance'}, {'function': {'function': <class 'pydantic.types.SecretStr'>, 'type': 'no-info'}, 'schema': {'strict': True, 'type': 'str'}, 'type': 'function-after'}], 'custom_error_type': 'string_type', 'type': 'union'}, 'serialization': {'function': <function _serialize_secret_field>, 'info_arg': True, 'type': 'function-plain', 'when_used': 'unless-none'}, 'type': 'json-or-python'}, 'type': 'lax-or-strict'}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}}, 'model_name': 'Token', 'type': 'model-fields'}, 'type': 'model'}

The core schema of the model.

__pydantic_custom_init__ = False

Whether the model has a custom __init__ method.

__pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})

Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.

__pydantic_extra_info__ = None

A wrapper around the __pydantic_extra__ annotation, if explicitly annotated on a model.

This is a private attribute, not meant to be used outside Pydantic.

__pydantic_fields__ = {'access_token': FieldInfo(annotation=SecretStr, required=True), 'expires_in': FieldInfo(annotation=int, required=True), 'refresh_token': FieldInfo(annotation=Union[SecretStr, NoneType], required=False, default=None)}

A dictionary of field names and their corresponding [FieldInfo][pydantic.fields.FieldInfo] objects. This replaces Model.__fields__ from Pydantic V1.

__pydantic_generic_metadata__ = {'args': (), 'origin': None, 'parameters': ()}

A dictionary containing metadata about generic Pydantic models.

The origin and args items map to the [__origin__][genericalias.__origin__] and [__args__][genericalias.__args__] attributes of [generic aliases][types-genericalias], and the parameter item maps to the __parameter__ attribute of generic classes.

__pydantic_parent_namespace__ = None

Parent namespace of the model, used for automatic rebuilding of models.

__pydantic_post_init__ = None

The name of the post-init method for the model, if defined.

__pydantic_serializer__ = SchemaSerializer(serializer=PolymorphismTrampoline(     PolymorphismTrampoline {         class: Py(             0x0000563f9b67cb90,         ),         serializer: Model(             ModelSerializer {                 class: Py(                     0x0000563f9b67cb90,                 ),                 serializer: Fields(                     GeneralFieldsSerializer {                         fields: SerFields {                             fields: [                                 SerField {                                     key: "expires_in",                                     alias: None,                                     serializer: Some(                                         Int(                                             IntSerializer,                                         ),                                     ),                                     required: true,                                     serialize_by_alias: None,                                     serialization_exclude_if: None,                                 },                                 SerField {                                     key: "access_token",                                     alias: None,                                     serializer: Some(                                         Function(                                             FunctionPlainSerializer {                                                 func: Py(                                                     0x00007fd33d031800,                                                 ),                                                 name: "plain_function[_serialize_secret_field]",                                                 function_name: "_serialize_secret_field",                                                 return_serializer: Any(                                                     AnySerializer,                                                 ),                                                 fallback_serializer: Some(                                                     JsonOrPython(                                                         JsonOrPythonSerializer {                                                             json: Str(                                                                 StrSerializer,                                                             ),                                                             python: Union(                                                                 UnionSerializer {                                                                     choices: UnionChoices {                                                                         choices: [                                                                             Any(                                                                                 AnySerializer,                                                                             ),                                                                             Str(                                                                                 StrSerializer,                                                                             ),                                                                         ],                                                                     },                                                                     name: "Union[any, str]",                                                                 },                                                             ),                                                             name: "json-or-python[json=str, python=Union[any, str]]",                                                         },                                                     ),                                                 ),                                                 when_used: UnlessNone,                                                 is_field_serializer: false,                                                 info_arg: true,                                             },                                         ),                                     ),                                     required: true,                                     serialize_by_alias: None,                                     serialization_exclude_if: None,                                 },                                 SerField {                                     key: "refresh_token",                                     alias: None,                                     serializer: Some(                                         WithDefault(                                             WithDefaultSerializer {                                                 default: Default(                                                     Py(                                                         0x00007fd33fb35120,                                                     ),                                                 ),                                                 serializer: Nullable(                                                     NullableSerializer {                                                         serializer: Function(                                                             FunctionPlainSerializer {                                                                 func: Py(                                                                     0x00007fd33d031800,                                                                 ),                                                                 name: "plain_function[_serialize_secret_field]",                                                                 function_name: "_serialize_secret_field",                                                                 return_serializer: Any(                                                                     AnySerializer,                                                                 ),                                                                 fallback_serializer: Some(                                                                     JsonOrPython(                                                                         JsonOrPythonSerializer {                                                                             json: Str(                                                                                 StrSerializer,                                                                             ),                                                                             python: Union(                                                                                 UnionSerializer {                                                                                     choices: UnionChoices {                                                                                         choices: [                                                                                             Any(                                                                                                 AnySerializer,                                                                                             ),                                                                                             Str(                                                                                                 StrSerializer,                                                                                             ),                                                                                         ],                                                                                     },                                                                                     name: "Union[any, str]",                                                                                 },                                                                             ),                                                                             name: "json-or-python[json=str, python=Union[any, str]]",                                                                         },                                                                     ),                                                                 ),                                                                 when_used: UnlessNone,                                                                 is_field_serializer: false,                                                                 info_arg: true,                                                             },                                                         ),                                                     },                                                 ),                                             },                                         ),                                     ),                                     required: true,                                     serialize_by_alias: None,                                     serialization_exclude_if: None,                                 },                             ],                             by_name: {                                 "refresh_token": 2,                                 "expires_in": 0,                                 "access_token": 1,                             },                         },                         computed_fields: Some(                             ComputedFields(                                 [],                             ),                         ),                         mode: SimpleDict,                         extra_serializer: None,                         filter: SchemaFilter {                             include: None,                             exclude: None,                         },                         required_fields: 3,                     },                 ),                 has_extra: false,                 root_model: false,                 name: "Token",             },         ),         enabled_from_config: false,     }, ), definitions=[])

The pydantic-core SchemaSerializer used to dump instances of the model.

__pydantic_setattr_handlers__ = {}

__setattr__ handlers. Memoizing the handlers leads to a dramatic performance improvement in __setattr__

__pydantic_validator__ = SchemaValidator(title="Token", validator=Model(     ModelValidator {         revalidate: Never,         validator: ModelFields(             ModelFieldsValidator {                 fields: [                     Field {                         name: "expires_in",                         lookup_path_collection: LookupPathCollection {                             by_name: LookupPath {                                 first_item: PathItemString(                                     "expires_in",                                 ),                                 rest: [],                             },                             by_alias: [],                         },                         validator: Int(                             IntValidator {                                 strict: false,                             },                         ),                         frozen: false,                     },                     Field {                         name: "access_token",                         lookup_path_collection: LookupPathCollection {                             by_name: LookupPath {                                 first_item: PathItemString(                                     "access_token",                                 ),                                 rest: [],                             },                             by_alias: [],                         },                         validator: LaxOrStrict(                             LaxOrStrictValidator {                                 strict: false,                                 lax_validator: JsonOrPython(                                     JsonOrPython {                                         json: FunctionAfter(                                             FunctionAfterValidator {                                                 validator: Str(                                                     StrValidator {                                                         strict: false,                                                         coerce_numbers_to_str: false,                                                     },                                                 ),                                                 func: Py(                                                     0x0000563f9affdca0,                                                 ),                                                 config: Py(                                                     0x00007fd33b9e3e40,                                                 ),                                                 name: "function-after[SecretStr(), str]",                                                 field_name: None,                                                 info_arg: false,                                             },                                         ),                                         python: Union(                                             UnionValidator {                                                 mode: Smart,                                                 choices: [                                                     (                                                         IsInstance(                                                             IsInstanceValidator {                                                                 class: Py(                                                                     0x0000563f9affdca0,                                                                 ),                                                                 class_repr: "SecretStr",                                                                 name: "is-instance[SecretStr]",                                                             },                                                         ),                                                         None,                                                     ),                                                     (                                                         FunctionAfter(                                                             FunctionAfterValidator {                                                                 validator: Str(                                                                     StrValidator {                                                                         strict: false,                                                                         coerce_numbers_to_str: false,                                                                     },                                                                 ),                                                                 func: Py(                                                                     0x0000563f9affdca0,                                                                 ),                                                                 config: Py(                                                                     0x00007fd33b9e3e40,                                                                 ),                                                                 name: "function-after[SecretStr(), str]",                                                                 field_name: None,                                                                 info_arg: false,                                                             },                                                         ),                                                         None,                                                     ),                                                 ],                                                 custom_error: Some(                                                     KnownError(                                                         PydanticKnownError {                                                             error_type: StringType {                                                                 context: None,                                                             },                                                         },                                                     ),                                                 ),                                                 name: "union[is-instance[SecretStr],function-after[SecretStr(), str]]",                                             },                                         ),                                         name: "json-or-python[json=function-after[SecretStr(), str],python=union[is-instance[SecretStr],function-after[SecretStr(), str]]]",                                     },                                 ),                                 strict_validator: JsonOrPython(                                     JsonOrPython {                                         json: FunctionAfter(                                             FunctionAfterValidator {                                                 validator: Str(                                                     StrValidator {                                                         strict: true,                                                         coerce_numbers_to_str: false,                                                     },                                                 ),                                                 func: Py(                                                     0x0000563f9affdca0,                                                 ),                                                 config: Py(                                                     0x00007fd33b9e3e40,                                                 ),                                                 name: "function-after[SecretStr(), str]",                                                 field_name: None,                                                 info_arg: false,                                             },                                         ),                                         python: Union(                                             UnionValidator {                                                 mode: Smart,                                                 choices: [                                                     (                                                         IsInstance(                                                             IsInstanceValidator {                                                                 class: Py(                                                                     0x0000563f9affdca0,                                                                 ),                                                                 class_repr: "SecretStr",                                                                 name: "is-instance[SecretStr]",                                                             },                                                         ),                                                         None,                                                     ),                                                     (                                                         FunctionAfter(                                                             FunctionAfterValidator {                                                                 validator: Str(                                                                     StrValidator {                                                                         strict: true,                                                                         coerce_numbers_to_str: false,                                                                     },                                                                 ),                                                                 func: Py(                                                                     0x0000563f9affdca0,                                                                 ),                                                                 config: Py(                                                                     0x00007fd33b9e3e40,                                                                 ),                                                                 name: "function-after[SecretStr(), str]",                                                                 field_name: None,                                                                 info_arg: false,                                                             },                                                         ),                                                         None,                                                     ),                                                 ],                                                 custom_error: Some(                                                     KnownError(                                                         PydanticKnownError {                                                             error_type: StringType {                                                                 context: None,                                                             },                                                         },                                                     ),                                                 ),                                                 name: "union[is-instance[SecretStr],function-after[SecretStr(), str]]",                                             },                                         ),                                         name: "json-or-python[json=function-after[SecretStr(), str],python=union[is-instance[SecretStr],function-after[SecretStr(), str]]]",                                     },                                 ),                                 name: "lax-or-strict[lax=json-or-python[json=function-after[SecretStr(), str],python=union[is-instance[SecretStr],function-after[SecretStr(), str]]],strict=json-or-python[json=function-after[SecretStr(), str],python=union[is-instance[SecretStr],function-after[SecretStr(), str]]]]",                             },                         ),                         frozen: false,                     },                     Field {                         name: "refresh_token",                         lookup_path_collection: LookupPathCollection {                             by_name: LookupPath {                                 first_item: PathItemString(                                     "refresh_token",                                 ),                                 rest: [],                             },                             by_alias: [],                         },                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x00007fd33fb35120,                                     ),                                 ),                                 on_error: Raise,                                 validator: Nullable(                                     NullableValidator {                                         validator: LaxOrStrict(                                             LaxOrStrictValidator {                                                 strict: false,                                                 lax_validator: JsonOrPython(                                                     JsonOrPython {                                                         json: FunctionAfter(                                                             FunctionAfterValidator {                                                                 validator: Str(                                                                     StrValidator {                                                                         strict: false,                                                                         coerce_numbers_to_str: false,                                                                     },                                                                 ),                                                                 func: Py(                                                                     0x0000563f9affdca0,                                                                 ),                                                                 config: Py(                                                                     0x00007fd33b9e3e40,                                                                 ),                                                                 name: "function-after[SecretStr(), str]",                                                                 field_name: None,                                                                 info_arg: false,                                                             },                                                         ),                                                         python: Union(                                                             UnionValidator {                                                                 mode: Smart,                                                                 choices: [                                                                     (                                                                         IsInstance(                                                                             IsInstanceValidator {                                                                                 class: Py(                                                                                     0x0000563f9affdca0,                                                                                 ),                                                                                 class_repr: "SecretStr",                                                                                 name: "is-instance[SecretStr]",                                                                             },                                                                         ),                                                                         None,                                                                     ),                                                                     (                                                                         FunctionAfter(                                                                             FunctionAfterValidator {                                                                                 validator: Str(                                                                                     StrValidator {                                                                                         strict: false,                                                                                         coerce_numbers_to_str: false,                                                                                     },                                                                                 ),                                                                                 func: Py(                                                                                     0x0000563f9affdca0,                                                                                 ),                                                                                 config: Py(                                                                                     0x00007fd33b9e3e40,                                                                                 ),                                                                                 name: "function-after[SecretStr(), str]",                                                                                 field_name: None,                                                                                 info_arg: false,                                                                             },                                                                         ),                                                                         None,                                                                     ),                                                                 ],                                                                 custom_error: Some(                                                                     KnownError(                                                                         PydanticKnownError {                                                                             error_type: StringType {                                                                                 context: None,                                                                             },                                                                         },                                                                     ),                                                                 ),                                                                 name: "union[is-instance[SecretStr],function-after[SecretStr(), str]]",                                                             },                                                         ),                                                         name: "json-or-python[json=function-after[SecretStr(), str],python=union[is-instance[SecretStr],function-after[SecretStr(), str]]]",                                                     },                                                 ),                                                 strict_validator: JsonOrPython(                                                     JsonOrPython {                                                         json: FunctionAfter(                                                             FunctionAfterValidator {                                                                 validator: Str(                                                                     StrValidator {                                                                         strict: true,                                                                         coerce_numbers_to_str: false,                                                                     },                                                                 ),                                                                 func: Py(                                                                     0x0000563f9affdca0,                                                                 ),                                                                 config: Py(                                                                     0x00007fd33b9e3e40,                                                                 ),                                                                 name: "function-after[SecretStr(), str]",                                                                 field_name: None,                                                                 info_arg: false,                                                             },                                                         ),                                                         python: Union(                                                             UnionValidator {                                                                 mode: Smart,                                                                 choices: [                                                                     (                                                                         IsInstance(                                                                             IsInstanceValidator {                                                                                 class: Py(                                                                                     0x0000563f9affdca0,                                                                                 ),                                                                                 class_repr: "SecretStr",                                                                                 name: "is-instance[SecretStr]",                                                                             },                                                                         ),                                                                         None,                                                                     ),                                                                     (                                                                         FunctionAfter(                                                                             FunctionAfterValidator {                                                                                 validator: Str(                                                                                     StrValidator {                                                                                         strict: true,                                                                                         coerce_numbers_to_str: false,                                                                                     },                                                                                 ),                                                                                 func: Py(                                                                                     0x0000563f9affdca0,                                                                                 ),                                                                                 config: Py(                                                                                     0x00007fd33b9e3e40,                                                                                 ),                                                                                 name: "function-after[SecretStr(), str]",                                                                                 field_name: None,                                                                                 info_arg: false,                                                                             },                                                                         ),                                                                         None,                                                                     ),                                                                 ],                                                                 custom_error: Some(                                                                     KnownError(                                                                         PydanticKnownError {                                                                             error_type: StringType {                                                                                 context: None,                                                                             },                                                                         },                                                                     ),                                                                 ),                                                                 name: "union[is-instance[SecretStr],function-after[SecretStr(), str]]",                                                             },                                                         ),                                                         name: "json-or-python[json=function-after[SecretStr(), str],python=union[is-instance[SecretStr],function-after[SecretStr(), str]]]",                                                     },                                                 ),                                                 name: "lax-or-strict[lax=json-or-python[json=function-after[SecretStr(), str],python=union[is-instance[SecretStr],function-after[SecretStr(), str]]],strict=json-or-python[json=function-after[SecretStr(), str],python=union[is-instance[SecretStr],function-after[SecretStr(), str]]]]",                                             },                                         ),                                         name: "nullable[lax-or-strict[lax=json-or-python[json=function-after[SecretStr(), str],python=union[is-instance[SecretStr],function-after[SecretStr(), str]]],strict=json-or-python[json=function-after[SecretStr(), str],python=union[is-instance[SecretStr],function-after[SecretStr(), str]]]]]",                                     },                                 ),                                 validate_default: false,                                 copy_default: false,                                 name: "default[nullable[lax-or-strict[lax=json-or-python[json=function-after[SecretStr(), str],python=union[is-instance[SecretStr],function-after[SecretStr(), str]]],strict=json-or-python[json=function-after[SecretStr(), str],python=union[is-instance[SecretStr],function-after[SecretStr(), str]]]]]]",                                 undefined: Py(                                     0x00007fd33d8fc740,                                 ),                             },                         ),                         frozen: false,                     },                 ],                 model_name: "Token",                 extra_behavior: Ignore,                 extras_validator: None,                 extras_keys_validator: None,                 strict: false,                 from_attributes: false,                 loc_by_alias: true,                 lookup: NoAliases(                     {                         PathItemString(                             "refresh_token",                         ): 2,                         PathItemString(                             "expires_in",                         ): 0,                         PathItemString(                             "access_token",                         ): 1,                     },                 ),                 validate_by_alias: None,                 validate_by_name: None,             },         ),         class: Py(             0x0000563f9b67cb90,         ),         generic_origin: None,         post_init: None,         frozen: false,         custom_init: false,         root_model: false,         undefined: Py(             0x00007fd33d8fc740,         ),         name: "Token",     }, ), definitions=[], cache_strings=True)

The pydantic-core SchemaValidator used to validate instances of the model.

__signature__ = <Signature (*, expires_in: int, access_token: pydantic.types.SecretStr, refresh_token: pydantic.types.SecretStr | None = None) -> None>

The synthesized __init__ [Signature][inspect.Signature] of the model.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class blacksmith.middleware._async.oauth2_token.AsyncOAuth2RefreshTokenMiddlewareFactory(*, client_id: str | UUID, client_secret: SecretStr | None = None, refresh_token: SecretStr | None = None, token_url: str, transport: AsyncAbstractTransport, timeout: HTTPTimeout | None = None, middlewares: list[AsyncHTTPMiddleware] | None = None, token_drift_seconds: int = 30, raise_oauth2_error: bool = True)

A middleware based on OAuth2.0 using a refresh token.

Parameters:
  • client_id – OAuth2.0 client id.

  • client_secret – OAuth2.0 client secret.

  • refresh_token – OAuth2.0 refresh token.

  • token_url – OAUth2 authorization server token url.

  • transport – Blacksmith transport to use.

  • timeout – HTTP timeout for the authorization server to retrieve token.

  • middlewares – List of blacksmith middleware to the token http call.

  • token_drift_seconds – Seconds to add to the expires in to avoid consuming an expired access token.

client_id: str | UUID
client_secret: SecretStr | None
refresh_token: SecretStr | None
access_token: SecretStr | None
expires_at: datetime | None
bmclient: Any
get_client() → AsyncClient[HTTPError]
async get_new_token() → None
async get_access_token() → SecretStr | None

Return an access token from the refresh_token

__call__(next: AsyncMiddleware) → AsyncMiddleware

Call self as a function.