pytwitcherapi.oauth.LoginServer

class pytwitcherapi.oauth.LoginServer(session)[source]

Bases: BaseHTTPServer.HTTPServer

This server responds to the redirection of the user after he granted authorization.

__init__(session)[source]

Initialize a new server.

The server will be on constants.LOGIN_SERVER_ADRESS.

Parameters:session (requests_oauthlib.OAuth2Session) – the session that needs a token
Raises:None

Methods

__init__(session) Initialize a new server.
close_request(request) Called to clean up an individual request.
fileno() Return socket file number.
finish_request(request, client_address) Finish one request by instantiating RequestHandlerClass.
get_request() Get the request and client address from the socket.
handle_error(request, client_address) Handle an error gracefully.
handle_request() Handle one request, possibly blocking.
handle_timeout() Called if no new request arrives within self.timeout.
process_request(request, client_address) Call finish_request.
serve_forever([poll_interval]) Handle one request at a time until shutdown.
server_activate() Called by constructor to activate the server.
server_bind() Override server_bind to store the server name.
server_close() Called to clean-up the server.
set_token(redirecturl) Set the token on the session
shutdown() Stops the serve_forever loop.
shutdown_request(request) Called to shutdown and close an individual request.
verify_request(request, client_address) Verify the request.

Attributes

address_family
allow_reuse_address
request_queue_size
socket_type
timeout
session = None

The session that needs a token

set_token(redirecturl)[source]

Set the token on the session

Parameters:redirecturl (str) – the original full redirect url
Returns:None
Return type:None
Raises:None