3

I want to use Google's Python client libraries to access the Google Drive API (v3). There is a quickstart document that shows the basic usage of some of Google's Python packages, but I cannot find a proper, complete documentation anywhere. Where do I need to look?

In particular, the quickstart document contains the following Python code:

from googleapiclient.discovery import build

...

    try:
        service = build('drive', 'v3', credentials=creds)

        # Call the Drive v3 API
        results = service.files().list(
            pageSize=10, fields="nextPageToken, files(id, name)").execute()
        items = results.get('files', [])

How do I know what methods and properties the service object has? This a complete blackbox to the user and I cannot find comprehensive documentation anywhere. PyCharm just sees service as an object of type Any and thus doesn't help me understand it.

Alex
  • 3,316
  • 4
  • 26
  • 52

1 Answers1

1

The documentation for the googleapiclient.discovery module can be found here: https://googleapis.github.io/google-api-python-client/docs/dyn/index.html

To see what methods and properties the service object has, you can use Python's built-in dir() function. For example:

print(dir(service))

You can also use the built-in help() function to get more information about a specific method or attribute. For example:

help(service.files().list)
nelsonsule
  • 334
  • 2
  • 8