Skip to content

Commit

Permalink
keyword handling still needed fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mahtin committed Feb 23, 2022
1 parent 1ca59e8 commit f1e3531
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions CloudFlare/cloudflare.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ def add(self, t, p1, p2=None, p3=None, p4=None, p5=None):
raise CloudFlareAPIError(0, 'api load type mismatch')

if keyword.iskeyword(name):
## add an extra keywork prefix'ed with underscore so it can used with Python code
## add an extra keyword postfix'ed with underscore so it can used with Python code
setattr(branch, name + '_', f)
if '-' in name:
# dashes (vs underscores) cause issues in Python and other languages
Expand All @@ -911,9 +911,13 @@ def api_list(self, m=None, s=''):
if 'delete' in d or 'get' in d or 'patch' in d or 'post' in d or 'put' in d:
# only show the result if a call exists for this part
if '_parts' in d:
# handle underscores by returning the actual API call vs the method name
w.append(str(a)[1:-1])
## w.append(str(a)[1:-1].replace('/:id/','/'))
if n[-1] == '_' and keyword.iskeyword(n[:-1]):
# remove the extra keyword postfix'ed with underscore
pass
else:
# handle underscores by returning the actual API call vs the method name
w.append(str(a)[1:-1])
## w.append(str(a)[1:-1].replace('/:id/','/'))
w = w + self.api_list(a, s + '/' + n)
return w

Expand Down

0 comments on commit f1e3531

Please sign in to comment.