샘플 코드가 다른거 같아요.
안녕하세요, 수강생 여러분
학습 관련 내용을 질문해주세요!
영상에나온 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())
개인적으로 스크래핑/크롤링하는 사이트에 대한 질문에 대해서는 답변을 드리지 않아요!
Answer 1
1
안녕하세요 우동현님!
먼저 강의에 나온코드는 구글 샘플 코드를 참조한 코드이며, 약간 변형이 있습니다.
강의에 나온것을 사용하시면 되며, 복사를 원하시는 경우 아래 깃허브 주소에서 가져가시면 됩니다!
https://github.com/heohyunjun/Inflearn-road-to-business-automation
감사합니다, 추가 질문있으신 경우 언제든 남겨주세요!
VKOSPI의 KRX open API 사용 download?
0
16
0
수강 연장 문의드립니다
0
35
1
작업형2에서 clip(0) 언제 써야하는지 알려주세요 !
0
41
1
작업형2에서 clip(0) 언제 써야하는지 알려주세요 !
0
22
1
60. 예시문제 작업형2(ver. 2025) 문의
0
36
2
코딩팡, 시험실제환경 질문
0
40
1
첫번째 영상 고화질 만드는 방법
0
19
0
섹션4 질문입니다
0
32
2
[작업형2] 레이블인코딩
0
32
2
[작업형2] train,test 범주 종류, 레이블인코딩 기준
0
28
1
2유형 train 전체 데이터 재학습
0
32
2
lab/cs-crew 관련 질문
0
19
0
책 내용 질문
0
33
2
기출11 작업형3
0
25
2
최종 학습 계획
0
38
2
올려주신 기출 & 출제방식 질문입니다!
0
36
2
(매우 긴급).env 관련 질문입니다.
0
23
1
15강 강의내용 코드 내용
0
25
1
작업형 2 최종 제출, 시험 풀이 순서
0
40
1
대본 오디오 생성 강의 마지막시트 에러 질문
0
23
0
10회 기출유형 (작업형3) 질문있습니다
0
30
2
fal ai 에서 http가 안뜹니다.
0
28
2
vs code와 github연결 방법을 모르겠어요
0
342
1
토큰 문제가 발생했어요
1
563
1

