google-api-python-client: Getting "Request contains an invalid argument" on script v1 requests

Environment details

  • OS: Windows 10 and Ubuntu 16.04
  • Python version: 2.7.12
  • pip version: 18.1
  • google-api-python-client version: 1.7.4 and 1.7.8

I’ve been using the script API for several months but within the last 2 days I am unable to even build the service as I keep getting “Request contains an invalid argument”.


store = Storage('oauth_creds.json')
credentials = store.get()
http = credentials.authorize(httplib2.Http())
service = discovery.build('script', 'v1', http=http)

Traceback is:

Traceback (most recent call last):
  File "D:\myscript.py", line 1000, in get_script_service
    service = discovery.build('script', 'v1', http=http)
  File "C:\Python27\lib\site-packages\googleapiclient\_helpers.py", line 130, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "C:\Python27\lib\site-packages\googleapiclient\discovery.py", line 230, in build
    raise e

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

I tried that but it didn’t work for me. Not sure why I had it like this originally but I ended up changing

http = credentials.authorize(httplib2.Http())
service = discovery.build('script', 'v1', http=http)

to this: service = discovery.build('script', 'v1', credentials=credentials)

and it’s working fine now.