def discover(uri):
 result = DiscoveryResult(uri)
 resp = fetchers.fetch(uri, headers={'Accept': YADIS_ACCEPT_HEADER})
 if (resp.status not in (200, 206)):
  raise DiscoveryFailure(('HTTP Response status from identity URL host is not 200. Got status %r' % (resp.status,)), resp)
 result.normalized_uri = resp.final_url
 result.content_type = resp.headers.get('content-type')
 result.xrds_uri = whereIsYadis(resp)
 if (result.xrds_uri and result.usedYadisLocation()):
  resp = fetchers.fetch(result.xrds_uri)
  if (resp.status not in (200, 206)):
   exc = DiscoveryFailure(('HTTP Response status from Yadis host is not 200. Got status %r' % (resp.status,)), resp)
   exc.identity_url = result.normalized_uri
   raise exc
  result.content_type = resp.headers.get('content-type')
 result.response_text = resp.body
 return result

def discover ( uri ) : result = DiscoveryResult ( uri ) resp = fetchers . fetch ( uri , headers = { 'Accept' : YADIS_ACCEPT_HEADER } ) if ( resp . status not in ( 200 , 206 ) ) : raise DiscoveryFailure ( ( 'HTTP Response status from identity URL host is not 200. Got status %r' % ( resp . status , ) ) , resp ) result . normalized_uri = resp . final_url result . content_type = resp . headers . get ( 'content-type' ) result . xrds_uri = whereIsYadis ( resp ) if ( result . xrds_uri and result . usedYadisLocation ( ) ) : resp = fetchers . fetch ( result . xrds_uri ) if ( resp . status not in ( 200 , 206 ) ) : exc = DiscoveryFailure ( ( 'HTTP Response status from Yadis host is not 200. Got status %r' % ( resp . status , ) ) , resp ) exc . identity_url = result . normalized_uri raise exc result . content_type = resp . headers . get ( 'content-type' ) result . response_text = resp . body return result
discover services for a given uri .