Skip to content

Commit

Permalink
Fixes for Bookmarking of Conversations & Messages (#8)
Browse files Browse the repository at this point in the history
* refactoring for exception classes & helper methods

* TDL-19674 changes

* Changes for TDL-19623

* directory struct change:improving readability for streams.py

* removed abstract decorator for set_params method

* Updated Circle Ci configuration file

Co-authored-by: Collin Simon <cosimon@users.noreply.github.com>

* Changes for TDL-19623

* removed streams.py

Co-authored-by: RushT007 <rtodkar@stitchdata-talend.com>
Co-authored-by: Collin Simon <cosimon@users.noreply.github.com>
Co-authored-by: “rdeshmukh15” <“redeshmukh@talend.com”>
  • Loading branch information
4 people authored Jul 7, 2022
1 parent 022e26e commit f6d27af
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions tap_dixa/streams/conversations.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,26 @@ class Conversations(IncrementalStream):

# pylint: disable=signature-differs
def get_records(self, start_date):
created_after = start_date
updated_after = start_date
end_dt = singer.utils.now()
add_interval = datetime.timedelta(hours=self.get_interval())
loop = True

while loop:
if (created_after + add_interval) < end_dt:
created_before = created_after + add_interval
if (updated_after + add_interval) < end_dt:
updated_before = updated_after + add_interval
else:
loop = False
created_before = end_dt
updated_before = end_dt

start = datetime_to_unix_ms(created_after)
end = datetime_to_unix_ms(created_before)
start = datetime_to_unix_ms(updated_after)
end = datetime_to_unix_ms(updated_before)

params = {'created_before': end, 'created_after': start}
params = {"updated_after": start, "updated_before": end}
response = self.client.get(self.base_url, self.endpoint, params=params)
for record in response:
record['updated_at_datestring'] = unix_ms_to_date(record['updated_at'])
record["updated_at_datestring"] = unix_ms_to_date(record["updated_at"])

yield from response
yield from response

created_after = created_before
updated_after = updated_before
4 changes: 2 additions & 2 deletions tap_dixa/streams/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ def get_records(self, start_date):
start = datetime_to_unix_ms(created_after)
end = datetime_to_unix_ms(created_before)

params = {"created_before": end, "created_after": start}
params = {"created_after": start,"created_before": end}
response = self.client.get(self.base_url, self.endpoint, params=params)

for record in response:
record["updated_at_datestring"] = unix_ms_to_date(end)
record["updated_at_datestring"] = unix_ms_to_date(record.get("created_at"))

yield from response

Expand Down

0 comments on commit f6d27af

Please sign in to comment.