Simon Breton
Simon Breton

Reputation: 2876

Cloud function Logging severity info inside API response

I' a bit lost with something I haven't seen before. I hope I will be able to explain my issue with clarity. I have the cloud function below:

    url = 'https://reports.api.clockify.me/v1/workspaces/xxxx/reports/detailed'
    headers = {'X-Api-Key': '{}'.format(api_key)}

    Start = "2022-01-01T00:00:00.000"
    End = "2022-03-26T23:59:59.000"

    page = 1
    raw_data = []

    while True:
      parameters = {"dateRangeStart":"{}".format(Start),"dateRangeEnd":"{}".format(End), "rounding": True, "exportType": "JSON", "amountShown": "EARNED","detailedFilter":{ "page":"{}".format(page),"pageSize":"1000"}}
      print(parameters)
      request = requests.post(url, headers=headers, json=parameters)
      #response = request.json()['timeentries']
      response = request.json()

      if len(response) == 0:
        break

      raw_data.append(response)
      page = page + 1

print(raw_data)

Everything is pretty standard (I think!). I'm looping through pages of clockify API request. The issue I have is that I found some logging information in my raw_data array.

When I'm printing the response I can see the following output in the log:

"severity": "INFO", "message": "{'totals': [{'_id': '', 'totalTime': 1345687, 'totalBillableTime': 1223465435, 'entriesCount': 1500, 'totalAmount': 23457354.0, 'amounts': [{'type': 'EARNED', 'value': 3746553.0}]}], 'timeentries': [{ .... standard clockify time entries ....

Why do I get "severity": "INFO", "message": when printing my response? Why is this part of my request? Then I found it in my raw_data array messing up with my JSON object... When using print I always have the raw value and not these logging info messages...

Upvotes: 0

Views: 113

Answers (0)

Related Questions