편집 안 : 다음은 메타 데이터에 액세스하고 얻을 ID로 기존 파일의 내용을 설정하는 방법입니다.
# Calling CreateFile() with an existing ID links it to the already existing file.
gdrive_file = drive.CreateFile({'id': '<your file id>'})
gdrive_file.FetchMetadata() # Only needed if you want to view or edit its metadata.
# Do things with metadata here as needed.
gdrive_file.GetContentFile('dog.png') # Download content file.
# And/or upload a new content file.
gdrive_file.SetContentFile('cat.png')
gdrive_file.Upload()
그리고 물론 docs에는 많은 예제가 있습니다.
원본 : 예를 들어 docs for file listings을 살펴보십시오.
확인 당신이 이
이 ID는
- 을
=
표지판,
- PyDrive은 구글 드라이브 API v2가 사용을 둘러싼 자신의 공간을 소개하는, 그래서 당신은 대신 the v2 search parameter page를 사용할 수 있는지 확인하지 마십시오
- 입니다 확인 Google 드라이브에서 할당 한 폴더 ID 인 this SO question은 ID를 찾는 방법을 나열합니다. 예를 들어
:
from pydrive.drive import GoogleDrive
drive = GoogleDrive(gauth) # Create GoogleDrive instance with authenticated GoogleAuth instance
folder_id = "insert your folder ID here"
# Auto-iterate through all files in the specified folder.
file_list = drive.ListFile({
'q': "{id} in parents and trashed=false".format(id=folder_id)
}).GetList()
for file1 in file_list:
print('title: %s, id: %s' % (file1['title'], file1['id']))
답변 해 주실 질문이 있습니까? 아니면 객관적인가? – Ukimiku
함수를 실행해야합니다. – simone989
"[...]은 무엇을 의미합니까?하지만 'id'가 아니어야합니다." 그것은 뭘해서는 안되나요? –