Open
Description
Hey I see you look very experienced in Google colab
I found an error using Google colab for some of my small projects
I didn't find any solution in any community like stack overflow,and other community
So I get you
The code is
import os
import google_auth_oauthlib.flow
import googleapiclient.discovery
scopes = ["https://www.googleapis.com/auth/youtube.readonly"]
def main():
os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"
api_service_name = "youtube"
api_version = "v3"
client_secrets_file = "/content/credentials.json"
# Get credentials and create an API client
flow = google_auth_oauthlib.flow.InstalledAppFlow.from_client_secrets_file(
client_secrets_file, scopes,redirect_uri="http://localhost:8800/")
authorization_url, _ = flow.authorization_url()
print(f"Please go to this URL to authorize: {authorization_url}")
authorization_response = input("Paste the authorization code here: ")
flow.fetch_token(
"https://accounts.google.com/o/oauth2/token",
authorization_response=authorization_response
)
youtube = googleapiclient.discovery.build(
api_service_name, api_version, credentials=flow.credentials)
request = youtube.channels().list(
part="snippet,contentDetails,statistics",
mine=True
)
response = request.execute()
print(response)
if name == "main":
main()
When opening the link and selecting my account after that it showing me
This site can’t be reached
localhost refused to connect.
Try:
Checking the connection
ERR_CONNECTION_REFUSED
(I dont want to use vs code( it works there ))
Metadata
Metadata
Assignees
Labels
No labels