D
D
dmitrieva_a2019-08-18 11:28:29
Python
dmitrieva_a, 2019-08-18 11:28:29

How to process Google Analytics API v4 response via Python?

Hello everyone,
I am developing a Google Analytics connector to the Microsoft database. I'm stuck in one place, I will be very glad if you help) It is
necessary that through the connector you can make multiple requests to different GA accounts (by view id), with different dates, metrics and measurements.
Actually, bypassing the connection to the API and the database, I make a request for a GA report.
I prescribe the configs in the nested dictionary, then I parse the answers, convert them to pandas df and for now I write the df to the sheet.
Everything was ok until the API response was processed. The view id, start and end dates are specified in the config, but they are not in the API response. And without them, it makes no sense to transfer data further to the database. You can still get away with the date by specifying it as a dimension, but without a view id it’s completely sad.
I don’t know how to pull out the view id, drag it from the config, or when I make a request to the API and is it really real or not
the code: https://pastebin.com/pZ4YEiAd
sample answer: https://pastebin.com/QW2mSB40

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2019-08-18
@dimonchik2013

the API has limits
of 10 per second, it seems, + 50k per day or so is pressed from above
, what is the point of such speed in the code?
why can't you create an object with a request attribute, assign the received data to the response attribute and work with the full set?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question