def MainCGI(method, path, unused_headers, parameters, outfile):
 if ((method != 'GET') and (method != 'POST')):
  outfile.write('Status: 400\r\n')
  return
 if (path == _GET_REQUEST_TOKEN_URL):
  OAuthGetRequestTokenCGI(outfile)
 elif (path == _AUTHORIZE_TOKEN_URL):
  OAuthAuthorizeTokenCGI(method, parameters, outfile)
 elif (path == _GET_ACCESS_TOKEN_URL):
  OAuthGetAccessTokenCGI(outfile)
 else:
  outfile.write('Status: 404 Unknown OAuth handler\r\n')

def MainCGI ( method , path , unused_headers , parameters , outfile ) : if ( ( method != 'GET' ) and ( method != 'POST' ) ) : outfile . write ( 'Status: 400\r\n' ) return if ( path == _GET_REQUEST_TOKEN_URL ) : OAuthGetRequestTokenCGI ( outfile ) elif ( path == _AUTHORIZE_TOKEN_URL ) : OAuthAuthorizeTokenCGI ( method , parameters , outfile ) elif ( path == _GET_ACCESS_TOKEN_URL ) : OAuthGetAccessTokenCGI ( outfile ) else : outfile . write ( 'Status: 404 Unknown OAuth handler\r\n' )
cgi for all oauth handlers .