Python API를 사용하여 Google 드라이브에서 파일을 다운로드하려고합니다. 설명서를 살펴보면서 서비스 인스턴스와 드라이브 파일 인스턴스라는 두 개의 인수를 사용하는 def가 표시됩니다. 어디서나 볼 수 없습니다. def에 전달할 드라이브 파일 인스턴스를 만드는 방법. 어떻게해야할까요? 어쩌면 여기서 단순한 것을 이해하지 못했을 것입니다 ...Google 드라이브 API로 파일 다운로드
답변
Temboo Python SDK를 사용해보십시오. 여기에는 Google 드라이브로 작업하기위한 간단한 방법이 포함되어 있습니다 (100+ 아피스).
난 당신이 언급하고있는 문서 페이지 모르지만, 순서대로 파일을 다운로드, 메타 데이터를 얻을 수 및합니다 (I가 Temboo에서 작동합니다. 전체 공개) https://www.temboo.com/library/Library/Google/Drive/Files/Get/
에서보세요 그것의 downloadUrl에 인증 된 요청.
f = service.files().get(fileId=file_id).execute()
resp, content = service._http.request(f.get('downloadUrl'))
다음 내용을 참조하십시오 : https://developers.google.com/drive/v2/reference/files/get. download_file이라는 def가 보일 것이고 두 개의 arg가 있습니다. – user165222
'drive_file = service.files(). get (fileId = file_id) .execute()', 도움이 되길 바랍니다. 문서화가 조금 이상하다. 문제를 해결해야한다. 감사. –
나는 Burcu의 답변에 동의합니다. Google 드라이브의 "get"메소드는 파일의 메타 데이터 만 반환합니다. 파일 내용을 검색하려면 Burcu에 표시된대로 downloadUrl 속성을 사용하여 다운로드해야합니다. 그래서 : 1. 메타 데이터를 얻습니다. 2. downloadUrl 속성을 추출합니다. 3. http 요청을 사용하여 다운로드합니다. https://developers.google.com/drive/web/examples/java#putting_together_the_pieces_getting_a_complete_set_of_credentials_for_every_request
:/**
* Returns the credentials of the user in the session. If user is not in the
* session, returns null.
* @param req Request object.
* @param resp Response object.
* @return Credential object of the user in session or null.
*/
protected Credential getCredential(HttpServletRequest req,
HttpServletResponse resp) {
String userId = (String) req.getSession().getAttribute(KEY_SESSION_USERID);
if (userId != null) {
return credentialManager.get(userId);
}
return null;
};
/**
* Build and return a Drive service object based on given request parameters.
* @param credential User credentials.
* @return Drive service object that is ready to make requests, or null if
* there was a problem.
*/
protected Drive getDriveService(Credential credential) {
return new Drive.Builder(TRANSPORT, JSON_FACTORY, credential).build();
}
완전한 설명은 당신이 참조 할 수 있습니다 :
질문에 따라, 예를 들어, 그래서 실제로 자격 증명 내장되어 "드라이브는 고화질에 전달할 인스턴스를 파일"
- 1. Google 드라이브 파일 다운로드
- 2. google 드라이브 파일 다운로드 URL
- 3. Google 드라이브 API로 파일 소유권을 변경 하시겠습니까?
- 4. Google 드라이브 API로 프로젝트 하시겠습니까? 그것은 가능합니까?
- 5. Google 드라이브 API로 다운로드 한 파일입니다. 어디에서나 찾을 수 없습니다.
- 6. iOS 용 Google 드라이브 API로 'Google doc'생성 파일 크기 검색
- 7. Google 드라이브 다운로드 문제
- 8. Google 드라이브 API v3 - PHP로 파일 다운로드
- 9. Google 드라이브 API로 Google 드라이브의 여유 공간을 확보하는 방법
- 10. Google 드라이브 Android 앱에 적용 및 Google 드라이브에서 파일 다운로드
- 11. 다운로드 진행률 얻기 Google 드라이브
- 12. Google 드라이브 REST API로 날짜 형식
- 13. Google 드라이브 API로 하위 폴더 생성
- 14. Google 드라이브 API로 Android Proguard 오류가 발생했습니다.
- 15. 드라이브 API 오류 파일 다운로드
- 16. google api로 파일 업로드
- 17. WEB API로 파일 다운로드 시뮬레이션
- 18. Google 드라이브 파일 액세스
- 19. Google 드라이브 파일 etag
- 20. Google 드라이브에서 이미지 파일 다운로드
- 21. OneDrive Rest API로 청크 다운로드
- 22. Google 드라이브 및 승인 된 HTTP GET으로 파일 다운로드
- 23. Google 드라이브 Android API를 사용하여 특정 MIME 유형의 파일 다운로드
- 24. Google 드라이브 API 공개 다운로드 비공개 계정 파일
- 25. ASP.NET에서 사용자의 브라우저 기본 대화 상자로 Google 드라이브 파일 다운로드
- 26. 앱 폴더에서 Android Google 드라이브 API 다운로드 파일
- 27. Google 드라이브 API httpRequest 다운로드 파일 대화 상자
- 28. Json api로 Google 저장 미디어 다운로드
- 29. 드라이브 문서를 부분적으로 다운로드
- 30. 다운로드 이미지 Google 드라이브 Android API에서?
쿨, 확인해 보겠습니다. – user165222