Skip to content

Commit

Permalink
Issue #595 fixes search export CBP
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptomail committed May 13, 2024
1 parent 438902e commit 5dd2463
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
8 changes: 0 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ run_linter: &run_linter
version: 2
jobs:
python3.5:
docker:
- image: cimg/python:3.5
working_director: ~/repo
steps:
- checkout
- <<: *run_tests
python3.6:
docker:
- image: cimg/python:3.6
Expand Down Expand Up @@ -80,7 +73,6 @@ workflows:
build_and_test:
jobs:
- linter
- python3.5
- python3.6
- python3.7
- python3.8
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml.XXX
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ classifiers = [
[project.urls]
"Homepage" = "https://github.com/facetoe/zenpy"
"Bug Tracker" = "https://github.com/faceto/zenpy/issues"

#nonce area
1 change: 1 addition & 0 deletions zenpy/lib/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def supports_cbp(self):
'organizations',
'organization_memberships',
'recipient_addresses',
'search/export.json',
'satisfaction_ratings',
'skips',
'suspended_tickets',
Expand Down
15 changes: 10 additions & 5 deletions zenpy/lib/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,16 @@ class SearchEndpoint(BaseEndpoint):
"""
def __call__(self, query=None, **kwargs):

renamed_kwargs = dict()
modifiers = list()
params = dict()
for key, value in kwargs.items():
if isinstance(value, datetime):
if key == 'cursor_pagination':
if value is True:
params['page[size]'] = 100
elif value is not False:
params['page[size]'] = value
elif isinstance(value, datetime):
kwargs[key] = value.strftime(self.ISO_8601_FORMAT)
elif isinstance(value, date):
kwargs[key] = value.strftime(self.ZENDESK_DATE_FORMAT)
Expand Down Expand Up @@ -353,9 +357,10 @@ def __call__(self, query=None, **kwargs):
elif is_iterable_but_not_string(value):
modifiers.append(self.format_or(key, value))
else:
if isinstance(value, str) and value.count(' ') > 0:
value = '"{}"'.format(value)
renamed_kwargs.update({key + ':': '%s' % value})
if (key != 'cursor_pagination'):
if isinstance(value, str) and value.count(' ') > 0:
value = '"{}"'.format(value)
renamed_kwargs.update({key + ':': '%s' % value})

search_query = [
'%s%s' % (key, value) for (key, value) in renamed_kwargs.items()
Expand Down
2 changes: 1 addition & 1 deletion zenpy/lib/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def next(self):
self.values = self.process_page()
if self.position >= len(self.values):
self.handle_pagination()
if len(self.values) < 1:
if len(self.values) < 1 or self.position >= len(self.values):
raise StopIteration()
zenpy_object = self.values[self.position]
self.position += 1
Expand Down

0 comments on commit 5dd2463

Please sign in to comment.