Skip to content

Commit 4a6acab

Browse files
committed
add purge all files in cache
1 parent f3cba51 commit 4a6acab

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

cloudflare_v4/util.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ def call(auth, method, endpoint, params=None):
3232
headers['Content-Type'] = 'application/json'
3333
logger.debug("headers being sent: " + str(headers))
3434
response = requests.post(url, headers=headers, json=params)
35+
elif method == 'DELETE':
36+
logger.debug("headers being sent: " + str(headers))
37+
response = requests.delete(url, headers=headers, json=params)
3538
data = response.text
3639
logger.debug("data received: " + data)
3740
try:

cloudflare_v4/zones/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ def get(auth, params=None):
88
return util.call(auth, 'GET', ENDPOINT, params)
99
elif type(params) is str:
1010
return util.call(auth, 'GET', ENDPOINT + '/' + params)
11+
12+
def purge(auth, params):
13+
return util.call(auth, 'DELETE', ENDPOINT + '/' + params + '/purge_cache', { 'purge_everything': True })

0 commit comments

Comments
 (0)