This API reference is intended mainly for developers and people looking for in-depth description of the different classes and functions. If you simply want to configure models and parse values into hyperlinks, quickstart
gives a better introduction to using the library.
hrefs
The two main building blocks of the hrefs
library are
Href
, the class representing hyperlinksReferrable
, the abstract base class of types that can be targets of hyperlinks
Href
Referrable
Any pydantic model that is a target of hyperlinks should implement BaseReferrableModel
. It inherits both pydantic.BaseModel
and hrefs.Referrable
.
BaseReferrableModel
PrimaryKey
HrefsConfigDict
hrefs.starlette
The main motivation for writing this library was to make it easy to use hyperlinks in FastAPI and Starlette applications. See quickstart
for a fully working example of how to use these classes.
HrefMiddleware
href_context
Developers of custom web framework integrations that work with BaseReferrableModel
need to implement a hyperlink resolver that acts as a bridge between the hrefs
library and the framework.
The implementation of hrefs.starlette
can be used as a reference.
hrefs.model.HrefResolver
hrefs.model.resolve_hrefs
hrefs.ReferrableModelError