1010
1111from dlt .common .configuration .inject import with_config
1212
13+
1314# function from: https://github.com/dlt-hub/verified-sources/tree/master/sources/zendesk
1415@dlt .source (max_table_nesting = 2 )
1516def zendesk_support (
1617 credentials : Dict [str , str ] = dlt .secrets .value ,
17- start_date : Optional [TAnyDateTime ] = pendulum .datetime ( # noqa: B008
18- year = 2000 , month = 1 , day = 1
19- ),
18+ start_date : Optional [TAnyDateTime ] = pendulum .datetime (year = 2000 , month = 1 , day = 1 ), # noqa: B008
2019 end_date : Optional [TAnyDateTime ] = None ,
2120):
2221 """
@@ -80,13 +79,15 @@ def _parse_date_or_none(value: Optional[str]) -> Optional[pendulum.DateTime]:
8079 return None
8180 return ensure_pendulum_datetime (value )
8281
82+
8383# modify dates to return datetime objects instead
8484def _fix_date (ticket ):
8585 ticket ["updated_at" ] = _parse_date_or_none (ticket ["updated_at" ])
8686 ticket ["created_at" ] = _parse_date_or_none (ticket ["created_at" ])
8787 ticket ["due_at" ] = _parse_date_or_none (ticket ["due_at" ])
8888 return ticket
8989
90+
9091# function from: https://github.com/dlt-hub/verified-sources/tree/master/sources/zendesk
9192def get_pages (
9293 url : str ,
@@ -127,6 +128,7 @@ def get_pages(
127128 if not response_json ["end_of_stream" ]:
128129 get_url = response_json ["next_page" ]
129130
131+
130132if __name__ == "__main__" :
131133 # create a pipeline with an appropriate name
132134 pipeline = dlt .pipeline (
@@ -146,7 +148,6 @@ def get_pages(
146148
147149 print (load_info )
148150
149-
150151 # running the Qdrant client to connect to your Qdrant database
151152
152153 @with_config (sections = ("destination" , "qdrant" , "credentials" ))
0 commit comments