Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def purge_key(self, service, key, soft=False):
if not isinstance(self.conn.authenticator, KeyAuthenticator):
raise AuthenticationError("This request requires an API key")
headers = {}
if soft:
headers['Fastly-Soft-Purge'] = 1
resp, data = self.conn.request('POST', '/service/%s/purge/%s' % (service, key), headers=headers)
return resp.status == 200