커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
4-5 강의 Google Book API 검색 오류
[왕초보] 플러터(Flutter)로 시작하는 앱개발 종합반
4주차
북마크
김*수
댓글
7
추천
0
조회수
8
조회수
8
답변 완료

* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.

* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.


4-5 Watcha Pedia 개발 강의에서 Google Book API 를 이용해서 검색을 하는데 검색 결과 에러가 나옵니다.

"dog"를 검색하면 dog 관련된 책이 검색되는 것이 아니라 서버에서 아래와 같이 에러를 보내줌.

(해당 URL을 크롬에 직접 입력해도 동일한 에러가 나옴)


{

  •   "error": {
  •     "code": 429,
  •     "message": "Quota exceeded for quota metric 'Queries' and limit 'Queries per day' of service 'books.googleapis.com' for consumer 'project_number:624717413613'.",
  •     "errors": [
  •       {
  •         "message": "Quota exceeded for quota metric 'Queries' and limit 'Queries per day' of service 'books.googleapis.com' for consumer 'project_number:624717413613'.",
  •         "domain": "global",
  •         "reason": "rateLimitExceeded"
  •       }
  •     ],
  •     "status": "RESOURCE_EXHAUSTED",
  •     "details": [
  •       {
  •         "@type": "type.googleapis.com/google.rpc.ErrorInfo",
  •         "reason": "RATE_LIMIT_EXCEEDED",
  •         "domain": "googleapis.com",
  •         "metadata": {
  •           "quota_location": "global",
  •           "quota_limit_value": "20000000",
  •           "service": "books.googleapis.com",
  •           "quota_limit": "defaultPerDayPerProject",
  •           "quota_metric": "books.googleapis.com/default",
  •           "consumer": "projects/624717413613"
  •         }
  •       },
  •       {
  •         "@type": "type.googleapis.com/google.rpc.Help",
  •         "links": [
  •           {
  •             "description": "Request a higher quota limit.",
  •             "url": "https://cloud.google.com/docs/quotas/help/request_increase"
  •           }
  •         ]
  •       }
  •     ]
  •   }

}





작성한 코드 및 에러 메세지

import 'package:dio/dio.dart';

import 'package:flutter/material.dart';


import 'book.dart';


class BookService extends ChangeNotifier {

  List<Book> bookList = []; // 책 목록


  void search(String q) async {

    if (q.isNotEmpty) {

      Response res = await Dio().get(

        "https://www.googleapis.com/books/v1/volumes?q=$q&startIndex=0&maxResults=40",

      );

      List items = res.data["items"];

      print(q);

      print(items);

    }

  }

}


오류 발생 시, 작성한 코드 전체와 에러 메시지를 첨부해 주세요.

<Debug Console 에 있는 에러 메시지>

E/flutter ( 7461): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: DioException [bad response]: This exception was thrown because the response has a status code of 429 and RequestOptions.validateStatus was configured to throw for this status code.

E/flutter ( 7461): The status code of 429 has the following meaning: "Client error - the request contains bad syntax or cannot be fulfilled"

E/flutter ( 7461): Read more about status codes at https://developer.mozilla.org/en-US/docs/Web/HTTP/Status

E/flutter ( 7461): In order to resolve this exception you typically have either to verify and fix your request code or you have to fix the server code.

E/flutter ( 7461):

Tip 1) </> 아이콘을 눌러 코드박스를 만들어 보세요.

Tip 2) Ctrl+A(맥의 경우 Command+A) 단축키로 코드를 한 번에 선택할 수 있어요!




취소
 공유
취소
댓글 0
댓글 알림
나의얼굴