mirror of
https://github.com/quantum5/qlinks.git
synced 2025-04-24 10:41:57 -04:00
Update to latest version of cloudflare package
This commit is contained in:
parent
dea0154077
commit
7ff577fd0c
|
@ -1,18 +1,16 @@
|
|||
from CloudFlare import CloudFlare
|
||||
from cloudflare import Cloudflare
|
||||
from django.conf import settings
|
||||
|
||||
from qlinks.cdn_cache import BaseCDNCache
|
||||
|
||||
|
||||
class CloudflareCDNCache(BaseCDNCache):
|
||||
cf: CloudFlare
|
||||
cf: Cloudflare
|
||||
zone: str
|
||||
|
||||
def __init__(self):
|
||||
self.cf = CloudFlare(token=getattr(settings, 'QLINKS_CDN_CLOUDFLARE_API_TOKEN', None))
|
||||
self.cf = Cloudflare(api_token=getattr(settings, 'QLINKS_CDN_CLOUDFLARE_API_TOKEN', None))
|
||||
self.zone = settings.QLINKS_CDN_CLOUDFLARE_ZONE_ID
|
||||
|
||||
def purge(self, url: str) -> None:
|
||||
self.cf.zones.purge_cache.post(self.zone, data={
|
||||
'files': [url],
|
||||
})
|
||||
self.cf.cache.purge(zone_id=self.zone, files=[url])
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
Django>=4.2,<5
|
||||
django-hosts
|
||||
requests
|
||||
cloudflare
|
||||
|
|
Loading…
Reference in a new issue