shravan_g_h
10/22/2022, 11:37 AMSven Balnojan
11/01/2022, 12:27 PMReuben (Matatika)
06/23/2023, 3:05 PMclient.py
def get_records(self, context):
dates: list = self.config["dates"]
# or implement some logic here to accept a start date/end date and construct a list of dates from those
# dates = get_dates(start=self.config["start_date"]) # from start_date up to today
# dates = get_dates(start=self.config["start_date"], end=self.config["end_date"]) # from start_date to end_date
for date in dates:
context["date"] = date
yield super().get_records(self, {**(context or {}), "date": date})
def get_url_params(self, context, next_page_token):
params = super().get_url_params(context, next_page_token)
params["lat"] = 18.5204
params["long"] = 73.8567
params["date"] = context["date"]
return params
Couple of things I'm not sure about:
• Is modifying context in this way is best practice or not?
• What are the implications of introducing a loop in get_records
that calls the super implementation?
• What are the implications of accepting a configurable date range as config?
Either way, can't hurt to try! 😅