Skip to content

Commit

Permalink
/certificates only needs X-Auth-User-Service-Key header, no email or …
Browse files Browse the repository at this point in the history
…token
  • Loading branch information
mahtin committed May 4, 2016
1 parent 9893b45 commit 6edde36
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions CloudFlare/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ def _call_with_auth(self, method, api_call_part1, api_call_part2=None, identifie
return self._call(method, headers, api_call_part1, api_call_part2, identifier1, identifier2, params, data)

def _call_with_certauth(self, method, api_call_part1, api_call_part2=None, identifier1=None, identifier2=None, params=None, data=None):
if self.EMAIL is '' or self.CERTTOKEN is '':
if self.CERTTOKEN is '':
raise CloudFlareAPIError(0, 'no email and/or cert token defined')
headers = { "X-Auth-Email": self.EMAIL, "X-Auth-User-Service-Key": self.CERTTOKEN, 'Content-Type': 'application/json' }
headers = { "X-Auth-User-Service-Key": self.CERTTOKEN, 'Content-Type': 'application/json' }
return self._call(method, headers, api_call_part1, api_call_part2, identifier1, identifier2, params, data)

def _call(self, method, headers, api_call_part1, api_call_part2=None, identifier1=None, identifier2=None, params=None, data=None):
Expand Down Expand Up @@ -68,9 +68,9 @@ def _call(self, method, headers, api_call_part1, api_call_part2=None, identifier
if method == 'GET':
response = requests.get(url, headers=headers, params=params, data=data)
elif method == 'POST':
response = requests.post(url, headers=headers, json=data)
response = requests.post(url, headers=headers, params=params, json=data)
elif method == 'PUT':
response = requests.put(url, headers=headers, json=data)
response = requests.put(url, headers=headers, params=params, json=data)
elif method == 'DELETE':
if data:
response = requests.delete(url, headers=headers, json=data)
Expand Down

0 comments on commit 6edde36

Please sign in to comment.