Hey guys, I have an issue with an external API. I already spent a few hours investigating this but still couldn’t crack it. An example of the API :
https://app.restreamsolutions.com/api/v1/sites/1007/data/?fields={{fields}}&start_datetime=2022-01-26 13:53:37&end_datetime=2022-01-26 13:53:42
In postman this example returns 6 records, but in the logs of my BE app it’s only 2.
I logged data.request.url and sent the request locally in jupyter notebook and it returns 6 records.
A piece of the code
def get_data(self,
start_datetime,
end_datetime,
fields):
params = {
'fields': ','.join(fields),
'start_datetime': start_datetime.strftime("%Y-%m-%d %H:%M:%S"),
'end_datetime': end_datetime.strftime("%Y-%m-%d %H:%M:%S")
}
data = requests.get(f'https://app.restreamsolutions.com/api/v1/sites/{self.site_id}/data/',
params,
headers=self.headers)
# Logger.info(f'{params=}')
Logger.info(f'{data.request.url=}')
Logger.info(f'{data.status_code=}')
Logger.info(f'{data.content=}')
data = data.json()
Logger.info(f'New record count: {len(data)}')
Logger.info(f'Data: {data}')
return data
Any ideas what I am missing?