Skip to content

Commit

Permalink
__del__() added - not very fancy; but cleaner network close now
Browse files Browse the repository at this point in the history
  • Loading branch information
mahtin committed Aug 10, 2022
1 parent 4a5da8b commit bd220aa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 0 additions & 2 deletions CloudFlare/api_v4.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
""" API core commands for Cloudflare API"""

import time

def api_v4(self):
""" API core commands for Cloudflare API"""

Expand Down
12 changes: 12 additions & 0 deletions CloudFlare/cloudflare.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ def __init__(self, config):
else:
self.logger = None

def __del__(self):
if self.network:
del self.network
self.network = None

def call_with_no_auth(self, method, parts,
identifier1=None, identifier2=None, identifier3=None, identifier4=None,
params=None, data=None, files=None):
Expand Down Expand Up @@ -979,6 +984,13 @@ def __init__(self, email=None, token=None, certtoken=None, debug=False, raw=Fals
except Exception as e:
raise CloudFlareAPIError(0, str(e))

def __del__(self):
""" Network for Cloudflare API"""

if self._base:
del self._base
self._base = None

def __call__(self):
""" Cloudflare v4 API"""

Expand Down

0 comments on commit bd220aa

Please sign in to comment.