From 7a153e60fab5dfc8e542349c81911662cd6cb1dc Mon Sep 17 00:00:00 2001 From: Sandro Modarelli Date: Thu, 14 Nov 2019 10:19:30 +0100 Subject: [PATCH] passing a list as purge input. removed input validation (#24) --- pystackpath/stacks.py | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/pystackpath/stacks.py b/pystackpath/stacks.py index 14ab2de..ef160ea 100644 --- a/pystackpath/stacks.py +++ b/pystackpath/stacks.py @@ -60,24 +60,9 @@ def cancel(self, reason_slug, reason_text=""): response.raise_for_status() return self - def purge(self, url, recursive=True, invalidateOnly=False, purgeAllDynamic=False, headers=[], purgeSelector=[]): - purgeSelectors = ["selectorType", "selectorName", "selectorValue", "selectorValueDelimter"] - - for value in purgeSelector: - if not value in purgeSelectors: - raise ValueError(f"{value} is not a valid purgeSelector: {purgeSelectors}") - + def purge(self, items: list): data = { - "items": [ - { - "url": url, - "recursive": recursive, - "headers": headers, - "invalidateOnly": invalidateOnly, - "purgeAllDynamic": purgeAllDynamic, - "purgeSelector": purgeSelector - } - ] + "items": items } response = self._client.post("/cdn/v1/stacks/{}/purge".format(self.id), json=data)