0

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...

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Simon Breton
  • 2,638
  • 7
  • 50
  • 105
  • 1
    The last part of your question seems a bit confusing. Can you elaborate on the part `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…`? Also can you provide the full function code? – Prabir Mar 28 '22 at 11:34
  • You create a standard log entry. Without any other information, the log is, by default, at INFO severity – guillaume blaquiere Mar 28 '22 at 15:00
  • @guillaumeblaquiere I'm only using `print()` statement and I usually don't have this severity INFO message stuff – Simon Breton Apr 07 '22 at 22:44
  • It is not clear which log statement are you talking about. Can you share your full function code and clarify where you are getting them printed? – Prabir Apr 13 '22 at 13:05
  • As you mentioned, it seems the Cloud Functions are behaving fine, and the issue is on the Clockify response side. – Gourav B May 04 '22 at 13:53

0 Answers0