inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

172만명의 커뮤니티!! 함께 토론해봐요.

토큰 문제가 발생했어요

해결됨

업무 자동화 첫걸음: Python으로 이메일 대량 전송하기와 크롤링 프로젝트 완성하기

안녕하세요. 좋은 강의 감사합니다. 수강하면서 실습 중 토큰 문제가 발생하였습니다. 에러는 아래와 같습니다. google.auth.exceptions.RefreshError: ('invalid_grant: Token has been expired or revoked.', {'error': 'invalid_grant', 'error_description': 'Token has been expired or revoked.'}) 기존에 작동하던 코드들도 동일한 문제가 발생하는데, 혹시 해결방법이 있을까요?? 강의 처음으로 돌아가서 진행하는데, 해결이 안되었습니다. 감사합니다.

  • python
  • slack
  • beautifulsoup
  • github-actions
  • gmail-api
우동현 댓글 1 좋아요 1 조회수 515

샘플 코드가 다른거 같아요.

해결됨

업무 자동화 첫걸음: Python으로 이메일 대량 전송하기와 크롤링 프로젝트 완성하기

안녕하세요, 수강생 여러분 학습 관련 내용을 질문해주세요! 영상에나온 Gmail Api python 샘플 코드와 현재 구글에서 제공하는 샘플 코드가 다른거같아요. 영상에서 나온 코드를 직접 타이핑 하면될까요? 참고로 구글에서 제공하는 샘플코드는 아래와 같아요. import os.path from google.auth.transport.requests import Request from google.oauth2.credentials import Credentials from google_auth_oauthlib.flow import InstalledAppFlow from googleapiclient.discovery import build from googleapiclient.errors import HttpError # If modifying these scopes, delete the file token.json. SCOPES = ["https://www.googleapis.com/auth/gmail.readonly"] def main(): """Shows basic usage of the Gmail API. Lists the user's Gmail labels. """ creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists("token.json"): creds = Credentials.from_authorized_user_file("token.json", SCOPES) # If there are no (valid) credentials available, let the user log in. if not creds or not creds.valid: if creds and creds.expired and creds.refresh_token: creds.refresh(Request()) else: flow = InstalledAppFlow.from_client_secrets_file( "credentials.json", SCOPES ) creds = flow.run_local_server(port=0) # Save the credentials for the next run with open("token.json", "w") as token: token.write(creds.to_json()) 개인적으로 스크래핑/크롤링하는 사이트에 대한 질문에 대해서는 답변을 드리지 않아요!

  • python
  • slack
  • beautifulsoup
  • github-actions
  • gmail-api
우동현 댓글 1 좋아요 1 조회수 365

인기 태그

인프런 TOP Writers

주간 인기글