pythonvisual-studio-codeyoutube-apiyoutube-data-api

How to enable Intellisense when using YouTube API with Python in VSCode


I want to get the IntelliSense in VSCode when using Google YouTube API with Python. But I don't know the detailed step.

from googleapiclient.discovery import build
api_key="****"
youtube=build("youtube","v3",developerKey=api_key)
request=youtube.channels().list(
    part="statistics",
    forUsername="****"
)

I can get Intellisense when inputting the "build(...)" method. But I can't get Intellisense when I input "channels()" and "list()" methods. Should I import other modules? When I code in Google Colab, I can get the Intellisense feature for all of the methods above. But in VSCode, only the "build" method has Intellisense.


Solution

  • The package google-api-python-client doesn't provide type hints.

    You could install third-party type stubs or add type hints manually by running the following command in your terminal:

    pip install google-api-python-client-stubs
    

    Reload your VSCode after installing package. Then Intellisense will work.

    enter image description here