pytwitcherapi.oauth.RedirectHandler

class pytwitcherapi.oauth.RedirectHandler(request, client_address, server)[source]

Bases: BaseHTTPServer.BaseHTTPRequestHandler

This request handler will handle the redirection of the user when he grants authorization to PyTwitcher and twitch redirects him.

__init__(request, client_address, server)

Methods

__init__(request, client_address, server)
address_string() Return the client address formatted for logging.
date_time_string([timestamp]) Return the current date and time formatted for a message header.
do_GET() Handle GET requests
do_POST() Handle POST requests
end_headers() Send the blank line ending the MIME headers.
finish()
handle() Handle multiple requests if necessary.
handle_one_request() Handle a single HTTP request.
log_date_time_string() Return the current time formatted for logging.
log_error(format, *args) Log an error.
log_message(format, *args) Log an arbitrary message.
log_request([code, size]) Log an accepted request.
parse_request() Parse a request (internal).
send_error(code[, message]) Send and log an error reply.
send_header(keyword, value) Send a MIME header.
send_response(code[, message]) Send the response header and log the response code.
setup()
version_string() Return the server software version string.

Attributes

default_request_version
disable_nagle_algorithm
error_content_type
error_message_format
extract_site_url
monthname
protocol_version
rbufsize
responses
server_version
success_site_url
sys_version
timeout
wbufsize
weekdayname
extract_site_url = '/'
success_site_url = '/success'
do_GET()[source]

Handle GET requests

If the path is ‘/’, a site which extracts the token will be generated. This will redirect the user to the ‘/sucess’ page, which shows a success message.

Returns:None
Return type:None
Raises:None
do_POST()[source]

Handle POST requests

When the user is redirected, this handler will respond with a website which will send a post request with the url fragment as parameters. This will get the parameters and store the original redirection url and fragments in LoginServer.tokenurl.

Returns:None
Return type:None
Raises:None