'why I am getting exceeded your quota Error with YouTube Data API

I am trying to use youtube data API to access public data, i.e., the popular videos in a region. I am having a problem with the request. Every time I use the JSON file, I get a URL to visit and I have to copy and paste code to my terminal to process the request. This is not what I need. After reading few answers on stackoverflow, it seems like since I am accessing public data, I have to removed these two lines of code:

flow = google_auth_oauthlib.flow.InstalledAppFlow.from_client_secrets_file(client_secrets_file, scopes) 

credentials = flow.run_console()

and added this line:

youtube = googleapiclient.discovery.build(api_service_name, api_version, developerKey=API_KEY)

with my API_KEY credentials!, however, I am making the first request with the API and I am getting this error!

googleapiclient.errors.HttpError: <HttpError 403 when requesting https://youtube.googleapis.com/youtube/v3/videos?part=snippet%2CcontentDetails%2Cstatistics&chart=mostPopular&maxResults=10&regionCode=US&pageToken=&key=AIzaSyBKYEVCjqqFC4QtE9z995RUbITuNgiI4Ks&alt=json returned "The request cannot be completed because you have exceeded your <a href="/youtube/v3/getting-started#quota">quota</a>.". Details: "[{'message': 'The request cannot be completed because you have exceeded your <a href="/youtube/v3/getting-started#quota">quota</a>.', 'domain': 'youtube.quota', 'reason': 'quotaExceeded'}]"> $

note that I set the maxResults=10, in my request. Any idea why? many thanks for the help in advance!

request = youtube.videos().list(
        part="snippet,contentDetails,statistics",
        chart="mostPopular",
        maxResults=10,
        regionCode=location,
        pageToken=accessToken
    )


Solution 1:[1]

I just had to wait 24 hours and the API key worked by itself. However, you should go to IAM & Admin then select Quotas. Make sure your project YouTube Data API v3 Queries per day is set to 10,000. If not, delete the project and recreate another project.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Arianna Newman