<s> from openid . yadis import discover <EOL> from omb import OMB_VERSION_01 , OMB_UPDATE_PROFILE , OMB_POST_NOTICE , OAUTH_REQUEST , OAUTH_ACCESS , OAUTH_AUTHORIZE , OAUTH_DISCOVERY <EOL> from pydataportability . xrds . parser import XRDSParser <EOL> import StringIO <EOL> def xrdsContainsServices ( xrds , service_names ) : <EOL> for service in service_names : <EOL> if not service in xrds : <EOL> return False <EOL> return True <EOL> def getServices ( profile_url ) : <EOL> """<STR_LIT>""" <EOL> dis = discover . discover ( profile_url ) <EOL> response = StringIO . StringIO ( dis . response_text . replace ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> xrds_services = { } <EOL> if dis . isXRDS ( ) : <EOL> xrds = XRDSParser ( response ) <EOL> for service in xrds . services : <EOL> xrds_services [ service . type ] = service <EOL> if len ( xrds_services ) < <NUM_LIT:1> : <EOL> return { } <EOL> if not xrdsContainsServices ( xrds_services , [ OAUTH_REQUEST , OAUTH_AUTHORIZE , OAUTH_ACCESS ] ) : <EOL> return { } <EOL> if not xrdsContainsServices ( xrds_services , [ OMB_POST_NOTICE , OMB_UPDATE_PROFILE ] ) : <EOL> return { } <EOL> return xrds_services <EOL> else : <EOL> return { } </s>
