Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

Commit

Permalink
passing a list as purge input. removed input validation (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
sandromodarelli authored Nov 14, 2019
1 parent 3bb0cf6 commit 7a153e6
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions pystackpath/stacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7a153e6

Please sign in to comment.