Build google API indexing bot by google-auth lib

I try to do indexing my site's pages to Google console tasks automatically by following Google indexing API docs. Find it here:

I also take a look at this question: Google Indexing API - Invalid attribute. 'url' is not in standard URL format - But my URL is Correct

However, when I excuted this code:

from oauth2client.service_account import ServiceAccountCredentials
import httplib2

SCOPES = [ "" ]

# service_account_file.json is the private key that you created for your service account.
JSON_KEY_FILE = "service_account_file.json"

credentials = ServiceAccountCredentials.from_json_keyfile_name(JSON_KEY_FILE, scopes=SCOPES)

http = credentials.authorize(httplib2.Http())

// Define contents here. This example shows a simple update request. Other types
// of requests are described in the next step.
content = "{
  \"url\": \"\",
  \"type\": \"URL_UPDATED"

response, content = http.request(ENDPOINT, method="POST", body=content)

I was informed that oauth2client.service_account was depreciated and I have turned to use Google-auth lib. Here is my attempt:

from google.oauth2.service_account import Credentials
from googleapiclient.discovery import build
from google.oauth2 import service_account
from google.auth.transport.requests import AuthorizedSession
import requests
import httplib2
import json

JSON_KEY_FILE = "my-service-account-key.json"
SCOPES = [""]
#credentials = Credentials.from_service_account_file
#credentials = ServiceAccountCredentials.from_json_keyfile_name(JSON_KEY_FILE, scopes=SCOPES)
credentials = service_account.Credentials.from_service_account_file(JSON_KEY_FILE)
scoped_credentials = credentials.with_scopes(SCOPES)
authed_session = AuthorizedSession(credentials)

content = {}
content['url'] = ""
content['type'] = "URL_UPDATED"
json_ctn = json.dumps(content)
response =, data=json_ctn)

And the console output of the snippet:

<google.oauth2.service_account.Credentials object at 0x08639770>
<google.auth.transport.requests.AuthorizedSession object at 0x0121DC70>
{"url": "", "type": "URL_UPDATED"}
Traceback (most recent call last):
  File "C:\Users\admin\Desktop\python\google\google console", line 39, in <module>
    response =, data=json_ctn)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\", line 581, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\google\auth\transport\", line 205, in request
    self._auth_request, method, url, request_headers)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\google\auth\", line 122, in before_request
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\google\oauth2\", line 322, in refresh
    request, self._token_uri, assertion)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\google\oauth2\", line 145, in jwt_grant
    response_data = _token_endpoint_request(request, token_uri, body)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\google\oauth2\", line 111, in _token_endpoint_request
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\google\oauth2\", line 61, in _handle_error_response
    error_details, response_body)
google.auth.exceptions.RefreshError: ('invalid_scope: Bad Request', '{\n  "error": "invalid_scope",\n  "error_description": "Bad Request"\n}')

I do not have experience in this field but I am developing a web and need to submit my site's pages quickly and automatically. So, please help me to edit the above code lines to reach the bottom line. Thanks!