@positional()
def get_version_data(session, url, authenticated=None):
 headers = {'Accept': 'application/json'}
 resp = session.get(url, headers=headers, authenticated=authenticated)
 try:
  body_resp = resp.json()
 except ValueError:
  pass
 else:
  try:
   return body_resp['versions']['values']
  except (KeyError, TypeError):
   pass
  try:
   return body_resp['versions']
  except KeyError:
   pass
  try:
   return [body_resp['version']]
  except KeyError:
   pass
 err_text = ((resp.text[:50] + '...') if (len(resp.text) > 50) else resp.text)
 msg = (_('Invalid Response - Bad version data returned: %s') % err_text)
 raise exceptions.DiscoveryFailure(msg)

@ positional ( ) def get_version_data ( session , url , authenticated = None ) : headers = { 'Accept' : 'application/json' } resp = session . get ( url , headers = headers , authenticated = authenticated ) try : body_resp = resp . json ( ) except ValueError : pass else : try : return body_resp [ 'versions' ] [ 'values' ] except ( KeyError , TypeError ) : pass try : return body_resp [ 'versions' ] except KeyError : pass try : return [ body_resp [ 'version' ] ] except KeyError : pass err_text = ( ( resp . text [ : 50 ] + '...' ) if ( len ( resp . text ) > 50 ) else resp . text ) msg = ( _ ( 'Invalid Response - Bad version data returned: %s' ) % err_text ) raise exceptions . DiscoveryFailure ( msg )
retrieve raw version data from a url .