Skip to content

Commit

Permalink
Merge branch 'master' into testbranch-aaditya
Browse files Browse the repository at this point in the history
  • Loading branch information
NiveditJain authored Feb 28, 2021
2 parents de6cc9f + ce1e066 commit e8da6ff
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions BunnyCDN/CDN.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def __init__(self,api_key):
def _Geturl(self,Task_name):
'''
This function is helper for the other methods in code to create appropriate url.
'''
if Task_name[0]=='/':
if Task_name[-1]=='/':
Expand All @@ -43,6 +44,7 @@ def _Geturl(self,Task_name):
def AddCertificate(self,PullZoneId,Hostname,Certificate,CertificateKey):
'''
This function adds custom certificate to the given pullzone
Parameters
----------
PullZoneId : int64
Expand Down Expand Up @@ -131,6 +133,7 @@ def RemoveBlockedIp(self,PullZoneId,BlockedIp):
def StorageZoneData(self):
'''
This function returns a list of details of each storage zones in user's account
'''
try :
response=requests.get(self._Geturl('storagezone'),headers=self.headers)
Expand Down Expand Up @@ -180,6 +183,7 @@ def StorageZoneList(self):
def AddStorageZone(self,storage_zone_name,storage_zone_region='DE',ReplicationRegions=['DE']):
'''
This method creates a new storage zone
Parameters
----------
storage_zone_name : string
Expand All @@ -196,6 +200,7 @@ def AddStorageZone(self,storage_zone_name,storage_zone_region='DE',ReplicationRe
ReplicationsRegions : array
(optional) The list of active replication regions for the zone
'''
values = json.dumps( {
"Name": storage_zone_name,
Expand All @@ -218,10 +223,12 @@ def GetStorageZone(self,storage_zone_id):

'''
This function returns details about the storage zone whose id is mentioned
Parameters
----------
storage_zone_id : int64
The ID of the Storage Zone to return
'''
try :
response=requests.get(self._Geturl(f'storagezone/{storage_zone_id}'),headers=self.headers)
Expand Down Expand Up @@ -275,6 +282,7 @@ def PurgeUrlCache(self,url):
def Billing(self):
'''
This method returns the current billing summary of the account
'''
try :
response=requests.get(self._Geturl('billing'),headers=self.headers)
Expand All @@ -293,6 +301,7 @@ def ApplyCode(self,couponCode):
Parameters
----------
couponCode : The promo code that will be applied
'''
try :
response=requests.get(self._Geturl('billing/applycode'),params={'couponCode':couponCode} ,headers=self.headers)
Expand All @@ -310,6 +319,7 @@ def Stats(self,dateFrom=None,dateTo=None,pullZone=None,serverZoneId=None,loadErr
Parameters
----------
dateFrom : string
(optional) The start date of the range the statistics should be returned for. Format: yyyy-mm-dd
Expand Down Expand Up @@ -344,6 +354,7 @@ def Stats(self,dateFrom=None,dateTo=None,pullZone=None,serverZoneId=None,loadErr
else:
return response.json()


def GetPullZoneList(self):
'''
This function fetches the list of pullzones in the User's Account
Expand Down

0 comments on commit e8da6ff

Please sign in to comment.