반응형
https://uipath.tistory.com/134
[Python] 구글 드라이브 API 연결해보기
https://uipath.tistory.com/133 [Python] 구글 드라이브 API 초기설정 https://console.cloud.google.com/ Google 클라우드 플랫폼 로그인 Google 클라우드 플랫폼으로 이동 accounts.google.com 구글 클라우드..
uipath.tistory.com
위 링크의 설정이 필요합니다.

구글드라이브에 폴더를 생성하는 코드입니다.
from Google import Create_Service
CLIENT_SECRET_FILE = 'client_secret.json' # 초기설정 json파일 이름
API_NAME = 'drive'
API_VERSION = 'v3'
SCOPES = ['https://www.googleapis.com/auth/drive']
service = Create_Service(CLIENT_SECRET_FILE, API_NAME, API_VERSION, SCOPES)
# 폴더 생성 테스트
folders = ['folder1', 'folder2', 'folder3']
for folder in folders:
file_metadata = {
'name': folder,
'mimeType': 'application/vnd.google-apps.folder'
}
service.files().create(body=file_metadata).execute()

코드를 실행하면 드라이브에 폴더가 생성됩니다.
반응형
'프로그래밍 > python' 카테고리의 다른 글
| [Python] dictionary 내의 모든 key를 int로 변경 (0) | 2022.06.18 |
|---|---|
| [selenium] 요소가 존재하지만 클릭 할 수 없는 오류 'Element is not clickable at point' (1) | 2022.06.17 |
| python dictionary to json (0) | 2022.06.14 |
| pyinstaller 자동업데이트 기능 AWS S3 (Exe) 자동업데이트 (1) | 2022.06.09 |
| pyinstaller 자동업데이트 github 연동 (0) | 2022.06.08 |