google drive api로 파일 업로드 후 permission 객체 리턴받기

632 단어 pythongoogleAPIAPI
file_resource = drive.files().create(body=metadata, media_body=path).execute()

일반적으로 이렇게 호출하고 file_resorce를 받아보면 file id 같은 정보만 있고 permissions 객체가 없다.

file_resource = drive.files().create(body=metadata, media_body=path, fields='id, permissions').execute()

이렇게 호출하면 permissions 객체를 리턴받을 수 있다.
permissions 객체 중에서도 특정 필드값만 얻어오고 싶으면 다음과 같이 사용하면 된다

file_resource = drive.files().create(body=metadata, media_body=path, fields='id, permissions(id, role, emailAddress)').execute()

좋은 웹페이지 즐겨찾기