def get_api_date(self):
<EOL>api_date = None<EOL>if self.date is not None and not isinstance(self.date, datetime):<EOL><INDENT>try:<EOL><INDENT>api_date = datetime.strptime(self.date, '<STR_LIT>')<EOL><DEDENT>except (TypeError, ValueError):<EOL><INDENT>self.logger.warning('<STR_LIT>', self.date)<EOL><DEDENT><DEDENT>if api_date is None:<EOL><INDENT>utc_time = pytz.utc.localize(datetime.utcnow())<EOL>eastern = pytz.timezone('<STR_LIT>')<EOL>api_date = eastern.normalize(utc_time.astimezone(eastern))<EOL>if api_date.hour < <NUM_LIT:10>:<EOL><INDENT>api_date -= timedelta(days=<NUM_LIT:1>)<EOL><DEDENT><DEDENT>self.date = api_date<EOL>
Figure out the date to use for API requests. Assumes yesterday's date
if between midnight and 10am Eastern time. Override this function in a
subclass to change how the API date is calculated.