현재 Python API 를 Google Storage
사용하여 일부 파일을 다운로드하려고합니다 . 분명히 이것은 gsutil의 cp 를 사용하여 수행 할 수 있으며 실제로 할 수 있습니다.
sudo gsutil cp gs://???/stats/installs/*.csv .
그러나 Google Python API
내가 찾은 모든 예제는 이 주제를 다루지 않으며이 기능이 API에 포함되는지 고려하고 있습니다.
이것은 되어 적용 파이썬 예 | 클라우드 스토리지 문서 | Google Cloud Platform ( 'google storage python wrapper'에서 Google 최초) :
개체를 다운로드하려면 :
storage/api/crud_object.py
(GitHub에서보기)def get_object(bucket, filename, out_file): service = create_service() # Use get_media instead of get to get the actual contents of the object. # http://g.co/dv/resources/api-libraries/documentation/storage/v1/python/latest/storage_v1.objects.html#get_media req = service.objects().get_media(bucket=bucket, object=filename) downloader = http.MediaIoBaseDownload(out_file, req) done = False while done is False: status, done = downloader.next_chunk() print("Download {}%.".format(int(status.progress() * 100))) return out_file
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다