설명서에 따라 Google Cloud Storage에 필요한 환경을 설정했습니다. "gsutil"을 설치하고 모든 경로를 설정했습니다. 나는 아래의 코드를 실행하려고하면 내 인 gsutil은, 그러나, 완벽하게 작동Python을 사용하는 Google Cloud Storage
#!/usr/bin/python
import StringIO
import os
import shutil
import tempfile
import time
from oauth2_plugin import oauth2_plugin
import boto
# URI scheme for Google Cloud Storage.
GOOGLE_STORAGE = 'gs'
# URI scheme for accessing local files.
LOCAL_FILE = 'file'
uri=boto.storage_uri('sangin2', GOOGLE_STORAGE)
try:
uri.create_bucket()
print "done!"
except boto.exception.StorageCreateError, e:
print "failed"
이주는 오류 "403 액세스가 거부되었습니다."
Traceback (most recent call last):
File "/Volumes/WingIDE-101-4.0.0/WingIDE.app/Contents/MacOS/src/debug/tserver/_sandbox.py", line 23, in <module>
File "/Users/lsangin/gsutil/boto/boto/storage_uri.py", line 349, in create_bucket
return conn.create_bucket(self.bucket_name, headers, location, policy)
File "/Users/lsangin/gsutil/boto/boto/gs/connection.py", line 91, in create_bucket
response.status, response.reason, body)
boto.exception.GSResponseError: GSResponseError: 403 Forbidden
<?xml version='1.0' encoding='UTF-8'?><Error><Code>AccessDenied</Code><Message>Access denied.</Message></Error>
저는이 말을 처음 접했기 때문에 그 이유를 알기가 다소 어려웠습니다. 누군가 나를 도울 수 있습니까? 감사합니다.
Google API 콘솔에서 Google 저장 용량을 활성화하셨습니까? 어디에서 oauth client_id, client_secret 등을 설정 했습니까? Google 서비스에 대해 인증해야합니까? –
네. 저는 gsutil을 설치했을 때 그 일을 잘했다고 생각합니다. 그러나 위의 코드는 "403 금지됨"오류를 표시합니다. 파이썬 경로를 지시 한대로 설정합니다 (export PYTHONPATH = $ {PYTHONPATH} : $ HOME/gsutil/boto : $ HOME/gsutil). 그러나 여전히 문제가됩니다. –
그럼 http://bits.google.com/group/gs-discussion/browse_thread/thread/5abe343e35a6d842?pli=1 도움이 될 것입니다. –