샘플 코드가 다른거 같아요.
안녕하세요, 수강생 여러분
학습 관련 내용을 질문해주세요!
영상에나온 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
감사합니다, 추가 질문있으신 경우 언제든 남겨주세요!
6-6
0
8
1
작업형 1 유형 부분
0
11
1
수강평 이벤트
0
17
2
작업형 1 (삭제예정, 구 버전)
0
31
2
강의노트는 어디있나요?
0
17
1
노션 학습 자료 권한 요청
0
17
1
수강기간 연장 문의드립니다.
0
21
1
2유형 레이블 인코딩 VS 원핫 인코딩
0
24
3
part2강의 문의사항입니다.
0
19
2
수강기간 연장 문의드립니다.
0
26
1
인덱스 슬라이싱
0
27
2
코드를 첨부해야하는 이유가 있나요?
0
20
2
소리가 겹쳐서 들려요
0
21
2
데스크톱과 노트북 연결
0
26
1
dict, zip
0
21
2
노션 : 파트3번 링크와 권한 , 파트4번 권한요청, 파트 5번도 미리 요청 드립니다.
0
27
4
6-6 실습 문의
0
24
2
미션 06-02
0
24
2
yes24 수집 md 파일 만들 때
0
24
2
python main.py 실행시 게임이 실행이 안돼요
0
27
2
antigravity 대신 cursor를 활용해도 되나요?
0
27
1
뉴스 검색 분류 한도초과
0
36
2
vs code와 github연결 방법을 모르겠어요
0
233
1
토큰 문제가 발생했어요
1
494
1

