コード例 #1
0
 def extractAPIKey(self,cs,raise_err=False):
     '''if the user has supplied a connection string then they dont need to specify an API key in their config file, therefore we must extract it from the cs'''
     srch = re.search('/([a-f0-9]{32})/(v/x|wfs\?)',cs,flags=re.IGNORECASE)
     if srch is None and raise_err:
         raise MalformedConnectionString('Cannot parse API key')
     return srch.group(1) if srch else None