[英]Why do i get connection reset by peer error when i try to use yomu with Amazon S3 to fetch text?
[英]S3::Error::SignatureDoesNotMatch: when I try and save a new object
这是我的保存文件,不是我尝试登录时出现的文件。这是我的代码:
service = S3::Service.new(
:access_key_id => S3_ACCESS_KEY,
:secret_access_key => S3_SECRET
)
puts "connection established with s3"
puts "finding bucket"
bucket = service.buckets.find("")
puts "building object"
object = bucket.objects.build("#{RAILS_ROOT}/jsonexport/ema.txt")
puts "saving object"
object.content = open("#{RAILS_ROOT}/export/ema.txt")
object.save
我可以在控制台中运行所有这些代码,直到到达object.save为止,然后引发此错误:
S3::Error::SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your key and signing method.
from /usr/local/lib/ruby/gems/1.8/gems/s3-0.3.0/lib/s3/connection.rb:209:in `handle_response'
from /usr/local/lib/ruby/gems/1.8/gems/s3-0.3.0/lib/s3/connection.rb:196:in `send_request'
from /usr/local/lib/ruby/gems/1.8/gems/s3-0.3.0/lib/s3/connection.rb:72:in `request'
from /usr/local/lib/ruby/gems/1.8/gems/s3-0.3.0/lib/s3/service.rb:64:in `service_request'
from /usr/local/lib/ruby/gems/1.8/gems/s3-0.3.0/lib/s3/bucket.rb:146:in `bucket_request'
from /usr/local/lib/ruby/gems/1.8/gems/s3-0.3.0/lib/s3/object.rb:196:in `object_request'
from /usr/local/lib/ruby/gems/1.8/gems/s3-0.3.0/lib/s3/object.rb:179:in `put_object'
from /usr/local/lib/ruby/gems/1.8/gems/s3-0.3.0/lib/s3/object.rb:74:in `save'
from (irb):8
有人有任何建议或想法吗?
好吧...这行得通。
service = S3::Service.new(
:access_key_id => S3_ACCESS_KEY,
:secret_access_key => S3_SECRET
)
puts "connection established with s3"
puts "finding bucket"
bucket = service.buckets.find("euro")
puts "building ema"
object = bucket.objects.build("jsonexport/ema.json")
puts "saving ema"
object.content = open("jsonexport/ema.json")
object.save
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.