Service Accounts
I got this working using a service account. It requires you to delegate domain-wide authority to the service account, which requires you to have G Suite. The G Suite admin will need to add the Client ID of the service account with the scope "https://www.googleapis.com/auth/webmasters.readonly".
After the service account is setup correctly, the code mostly worked as-is. I only added the scope and the user the service account is impersonating to the auth process. Compared to the existing quickstart example, I only changed line 2 to account = searchconsole.authenticate(service_account='client_secrets.json', user_email='[email protected]') and the experience is identical, obviously excluding the interactive parts.
Hi @andyoneal - sorry for being so slow getting back to you. Really appreciate the contribution!
Is this functionality different to the service account feature implemented in this service-accounts branch?
There's some discussion of service accounts and my reluctance to merge without a service account to test with here.