def OAuthAuthorizeTokenCGI(method, parameters, outfile):
 oauth_callback = GetFirst(parameters, _OAUTH_CALLBACK_PARAM, '')
 if (method == 'GET'):
  outfile.write('Status: 200\r\n')
  outfile.write('Content-Type: text/html\r\n')
  outfile.write('\r\n')
  outfile.write(RenderTokenApprovalTemplate(oauth_callback))
 elif (method == 'POST'):
  if oauth_callback:
   outfile.write('Status: 302 Redirecting to callback URL\r\n')
   outfile.write(('Location: %s\r\n' % oauth_callback))
   outfile.write('\r\n')
  else:
   outfile.write('Status: 200\r\n')
   outfile.write('Content-Type: text/html\r\n')
   outfile.write('\r\n')
   outfile.write(RenderTokenApprovedTemplate())
 else:
  outfile.write('Status: 400 Unsupported method\r\n')

def OAuthAuthorizeTokenCGI ( method , parameters , outfile ) : oauth_callback = GetFirst ( parameters , _OAUTH_CALLBACK_PARAM , '' ) if ( method == 'GET' ) : outfile . write ( 'Status: 200\r\n' ) outfile . write ( 'Content-Type: text/html\r\n' ) outfile . write ( '\r\n' ) outfile . write ( RenderTokenApprovalTemplate ( oauth_callback ) ) elif ( method == 'POST' ) : if oauth_callback : outfile . write ( 'Status: 302 Redirecting to callback URL\r\n' ) outfile . write ( ( 'Location: %s\r\n' % oauth_callback ) ) outfile . write ( '\r\n' ) else : outfile . write ( 'Status: 200\r\n' ) outfile . write ( 'Content-Type: text/html\r\n' ) outfile . write ( '\r\n' ) outfile . write ( RenderTokenApprovedTemplate ( ) ) else : outfile . write ( 'Status: 400 Unsupported method\r\n' )
runs the oauthauthorizetoken cgi .