The authomatic.login() function needs access to functionality like getting the URL of the handler where it is being called, getting the request params and cookies and writing the body, headers and status to the response.
Since implementation of these features varies across Python web frameworks, the Authomatic library uses adapters to unify these differences into a single interface.
If you are missing an adapter for the framework of your choice, please open an enhancement issue or consider a contribution to this module by implementing one by yourself. Its very easy and shouldn’t take you more than a few minutes.
- class authomatic.adapters.DjangoAdapter(request, response)¶
Adapter for the Django framework.
- class authomatic.adapters.Webapp2Adapter(handler)¶
Adapter for the Webapp2 framework.
Inherits from the WebObAdapter.
Parameters: handler – A webapp2.RequestHandler instance.
- class authomatic.adapters.WebObAdapter(request, response)¶
Adapter for the WebOb package.
Implementing an Adapter¶
Implementing an adapter for a Python web framework is pretty easy.
Do it by subclassing the BaseAdapter abstract class. There are only six members that you need to implement.
- class authomatic.adapters.BaseAdapter¶
Base class for platform adapters
Defines common interface for WSGI framework specific functionality.
Must return the url of the actual request including path but without query and fragment
Must write specified value to response.
Parameters: value (str) – String to be written to response.
- set_header(key, value)¶
Must set response headers to Key: value.