def supports_carddav(url):
 response = requests.request('OPTIONS', url, headers={'User-Agent': USER_AGENT, 'Depth': '1'})
 response.raise_for_status()
 if ('addressbook' not in response.headers.get('DAV', '')):
  raise Exception('URL is not a CardDAV resource')

def supports_carddav ( url ) : response = requests . request ( 'OPTIONS' , url , headers = { 'User-Agent' : USER_AGENT , 'Depth' : '1' } ) response . raise_for_status ( ) if ( 'addressbook' not in response . headers . get ( 'DAV' , '' ) ) : raise Exception ( 'URL is not a CardDAV resource' )
basic verification that the endpoint supports carddav .