샘플 코드가 다른거 같아요.
안녕하세요, 수강생 여러분
학습 관련 내용을 질문해주세요!
영상에나온 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())
개인적으로 스크래핑/크롤링하는 사이트에 대한 질문에 대해서는 답변을 드리지 않아요!
回答 1
1
안녕하세요 우동현님!
먼저 강의에 나온코드는 구글 샘플 코드를 참조한 코드이며, 약간 변형이 있습니다.
강의에 나온것을 사용하시면 되며, 복사를 원하시는 경우 아래 깃허브 주소에서 가져가시면 됩니다!
https://github.com/heohyunjun/Inflearn-road-to-business-automation
감사합니다, 추가 질문있으신 경우 언제든 남겨주세요!
git bash .env
0
9
0
예제 001 실행 안됩니다.
0
11
2
ipython 설치가 안되는거 같습니다.
0
9
1
이론 공부법 요약본 버전 업데이트 문의
0
11
1
피드백 내용 문의드립니다.
0
20
0
백준 서비스 종료로 인한 강의 자료 업데이트 요청드립니다.
0
21
1
백준 사이트 준비중이라 문제를 볼 수 가 없어요
0
19
1
작업형 1번문제... 환경관련
0
22
2
09차 네이버 영화 리뷰 수집 실습 관련 질문
0
25
1
12회 기출은 언제 업데이트 될까요??
0
28
2
알파벤티지 sleep(5) 관련 문의
1
36
2
강의 자료 및 코드 수령
0
29
2
8/6 작성한 연장문의 질문글에 대한 재요청
0
35
2
실전 계좌에서 운영하고 계신 분 계신가요?
1
40
2
수강기간 연장 문의
0
28
2
수강기간 연장문의
0
34
2
수강기간 연장 요청 문의드립니다
0
32
2
Fal.ai에 기존 AI를 끌어오는것은 안되는건가요?
0
34
2
잘못된 파일 다운로드
0
35
1
DataSet 다운 받는 방법
0
30
1
어디다가 환불요청해야돼요
0
42
1
해당 차수 영상이 짤려 나갑니다
0
44
1
vs code와 github연결 방법을 모르겠어요
0
303
1
토큰 문제가 발생했어요
1
523
1

