샘플 코드가 다른거 같아요.
안녕하세요, 수강생 여러분
학습 관련 내용을 질문해주세요!
영상에나온 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
감사합니다, 추가 질문있으신 경우 언제든 남겨주세요!
loop is not defined
0
6
1
slack 알림 연동 강의 관련
1
12
2
가상환경 설정이 안됩니다
0
8
0
supabase_key 관련
1
26
3
프롬프트의 영문 버전을 만들 때, 출력 규칙에 포함된 한글 부분은 영어로 번역하지 않고 그대로 유지하면서, 영문 편과 한글 편을 한 번에 함께 출력하려면 어떤 워크플로우로 구성하면 좋을까요?
0
19
0
프로그램은 뭘 사용하시는 건가요??
1
20
2
수업자료와 노션 공유 문제
0
34
3
python run.py 실행시 에러 문제
1
62
2
조건 반복문 질문: for 문 ?
0
41
1
54강 4분 41초에서 질문 있어요.
0
38
1
커서창
1
41
2
강의 제작
1
42
1
23강 질문드립니다, 강사님.
0
27
1
import
0
31
1
45강 예제4번에서 질문 있어요!
0
42
1
45강 강의 10분 03초 내용에서 x + 1 을 하는 이유는 뭔가요?
0
35
1
Json.stringify 관련 오류일까요?
0
36
2
3강, 7강 화면이 안나옵니다. 그냥 검은화면으로만 노출되요;;
0
35
1
cursor 환경
1
51
2
Gradio 실행 시 에러 발생 문의
0
48
2
Gradio 실행 시 Jinja2 / ASGI TypeError: unhashable type: 'dict' 에러 문의
0
50
2
안녕하세요, 강의자료 요청드립니다
0
35
1
vs code와 github연결 방법을 모르겠어요
0
285
1
토큰 문제가 발생했어요
1
515
1





