You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the end date is on the first of a month (e.g. October 1st), a request is issued both for dates in September and October. However, the end date is documented to be exclusive for this script, as it's the checkout date. So an extra unneeded request is being issued, which given the sensitive rate limiting on recreation.gov, would add to the instability.
Cause:
An rrule monthly rule includes the end date by default, so get_park_information ends up fetching for both months.
Solution:
I believe this can be solved by excluding the end date using exdate. Something like this:
start_of_month = datetime(start_date.year, start_date.month, 1)
ruleset = rrule.rruleset()
ruleset.rrule(rrule.rrule(rrule.MONTHLY, dtstart=start_of_month, until=end_date))
# exclude end date as that is the checkout date
ruleset.exdate(end_date)
months = list(ruleset)
I haven't robustly tested this to ensure it doesn't break other scenarios, but seems to work for my use case.
The text was updated successfully, but these errors were encountered:
When the end date is on the first of a month (e.g. October 1st), a request is issued both for dates in September and October. However, the end date is documented to be exclusive for this script, as it's the checkout date. So an extra unneeded request is being issued, which given the sensitive rate limiting on recreation.gov, would add to the instability.
Cause:
An rrule monthly rule includes the end date by default, so get_park_information ends up fetching for both months.
Solution:
I believe this can be solved by excluding the end date using
exdate
. Something like this:I haven't robustly tested this to ensure it doesn't break other scenarios, but seems to work for my use case.
The text was updated successfully, but these errors were encountered: