Getting Error - #<Google::Apis::ServerError: unsupported proxy proxy.xyz.com:8080> while configuring proxy for google-api-ruby-client-0.10.0 gem
Getting Error - #<Google::Apis::ServerError: unsupported proxy proxy.xyz.com:8080> while configuring proxy for google-api-ruby-client-0.10.0 gem
我正在使用 google-drive-ruby gem 将 Google-Drive 集成到我的 rails 项目。 google-drive-ruby gem 对 google-[= 有 运行 时间依赖81=]-ruby-客户端 gem。
我正在尝试在 configure_client 方法中配置代理 http_client_adapter.rb
def configure_client(client, request)
client.transparent_gzip_decompression = true
if true #request.options.proxy
#proxy = request.options.proxy
proxy = URI('http://proxy.xyz.com:8080')
proxy_user = '*******'
proxy_pass = '*******'
client.proxy = sprintf('%s:%d', proxy.host, proxy.port)
if proxy_user && proxy_pass
client.set_proxy_auth proxy_user, proxy_pass
end
end
end
错误跟踪如下:
Google::Apis::ServerError: 不支持的代理 #
来自 D:/g_drive_local/BMajor/gems/google-api-ruby-client-0100/google-api-ruby-client-0.10.0/lib/google/apis/core/upload.rb:231:in rescue in send_start_command'
from D:/g_drive_local/BMajor/gems/google-api-ruby-client-0100/google-api-ruby-client-0.10.0/lib/google/apis/core/upload.rb:214:in
send_start_command'
来自 D:/g_drive_local/BMajor/gems/google-api-ruby-client-0100/google-api-ruby-client-0.10.0/lib/google/apis/core/upload.rb:279:in execute_once'
from D:/g_drive_local/BMajor/gems/google-api-ruby-client-0100/google-api-ruby-client-0.10.0/lib/google/apis/core/http_command.rb:107:in
block (2 levels) in execute'
来自 D:/Ruby/ruby gems/ruby/lib/ruby/gems/2.0.0/gems/retriable-3.1.2/lib/retriable.rb:61:in block in retriable'
from D:/Ruby/ruby gems/ruby/lib/ruby/gems/2.0.0/gems/retriable-3.1.2/lib/retriable.rb:56:in
times'
来自 D:/Ruby/ruby gems/ruby/lib/ruby/gems/2.0.0/gems/retriable-3.1.2/lib/retriable.rb:56:in retriable'
from D:/g_drive_local/BMajor/gems/google-api-ruby-client-0100/google-api-ruby-client-0.10.0/lib/google/apis/core/http_command.rb:104:in
block in execute'
来自 D:/Ruby/ruby gems/ruby/lib/ruby/gems/2.0.0/gems/retriable-3.1.2/lib/retriable.rb:61:in block in retriable'
from D:/Ruby/ruby gems/ruby/lib/ruby/gems/2.0.0/gems/retriable-3.1.2/lib/retriable.rb:56:in
times'
来自 D:/Ruby/ruby gems/ruby/lib/ruby/gems/2.0.0/gems/retriable-3.1.2/lib/retriable.rb:56:in retriable'
from D:/g_drive_local/BMajor/gems/google-api-ruby-client-0100/google-api-ruby-client-0.10.0/lib/google/apis/core/http_command.rb:96:in
execute'
来自 D:/g_drive_local/BMajor/gems/google-api-ruby-client-0100/google-api-ruby-client-0.10.0/lib/google/apis/core/base_service.rb:353:in execute_or_queue_command'
from D:/g_drive_local/BMajor/gems/google-api-ruby-client-0100/google-api-ruby-client-0.10.0/generated/google/apis/drive_v3/service.rb:579:in
create_file'
来自 D:/g_drive_local/BMajor/gems/google-drive-ruby-200/google-drive-ruby-2.0.0/lib/google_drive/session.rb:409:in upload_from_source'
from D:/g_drive_local/BMajor/gems/google-drive-ruby-200/google-drive-ruby-2.0.0/lib/google_drive/session.rb:308:in
upload_from_file'
来自(IRB):2
来自 D:/Ruby/ruby gems/ruby/lib/ruby/gems/2.0.0/gems/railties-4.0.4/lib/rails/commands/console.rb:90:in start'
from D:/Ruby/ruby gems/ruby/lib/ruby/gems/2.0.0/gems/railties-4.0.4/lib/rails/commands/console.rb:9:in
start'
来自 D:/Ruby/ruby gems/ruby/lib/ruby/gems/2.0.0/gems/railties-4.0.4/lib/rails/commands.rb:62:in <top (required)>'
from bin/rails:4:in
require'
来自 bin/rails:4:in `'
通过点击和试用,我自己解决了这个问题。
这就是我在 http_client_adapter.rb 中配置代理的方式:
def configure_client(client, request)
client.transparent_gzip_decompression = true
if true #request.options.proxy
#proxy = request.options.proxy
proxy = URI('http://proxy.xyz.com:8080')
proxy_user = '*******'
proxy_pass = '*******'
client.proxy = 'http://username:password@hostname:port'
if proxy_user && proxy_pass
client.set_proxy_auth proxy_user, proxy_pass
end
end
end
我正在使用 google-drive-ruby gem 将 Google-Drive 集成到我的 rails 项目。 google-drive-ruby gem 对 google-[= 有 运行 时间依赖81=]-ruby-客户端 gem。
我正在尝试在 configure_client 方法中配置代理 http_client_adapter.rb
def configure_client(client, request)
client.transparent_gzip_decompression = true
if true #request.options.proxy
#proxy = request.options.proxy
proxy = URI('http://proxy.xyz.com:8080')
proxy_user = '*******'
proxy_pass = '*******'
client.proxy = sprintf('%s:%d', proxy.host, proxy.port)
if proxy_user && proxy_pass
client.set_proxy_auth proxy_user, proxy_pass
end
end
end
错误跟踪如下:
Google::Apis::ServerError: 不支持的代理 #
来自 D:/g_drive_local/BMajor/gems/google-api-ruby-client-0100/google-api-ruby-client-0.10.0/lib/google/apis/core/upload.rb:231:in rescue in send_start_command'
from D:/g_drive_local/BMajor/gems/google-api-ruby-client-0100/google-api-ruby-client-0.10.0/lib/google/apis/core/upload.rb:214:in
send_start_command'
来自 D:/g_drive_local/BMajor/gems/google-api-ruby-client-0100/google-api-ruby-client-0.10.0/lib/google/apis/core/upload.rb:279:in execute_once'
from D:/g_drive_local/BMajor/gems/google-api-ruby-client-0100/google-api-ruby-client-0.10.0/lib/google/apis/core/http_command.rb:107:in
block (2 levels) in execute'
来自 D:/Ruby/ruby gems/ruby/lib/ruby/gems/2.0.0/gems/retriable-3.1.2/lib/retriable.rb:61:in block in retriable'
from D:/Ruby/ruby gems/ruby/lib/ruby/gems/2.0.0/gems/retriable-3.1.2/lib/retriable.rb:56:in
times'
来自 D:/Ruby/ruby gems/ruby/lib/ruby/gems/2.0.0/gems/retriable-3.1.2/lib/retriable.rb:56:in retriable'
from D:/g_drive_local/BMajor/gems/google-api-ruby-client-0100/google-api-ruby-client-0.10.0/lib/google/apis/core/http_command.rb:104:in
block in execute'
来自 D:/Ruby/ruby gems/ruby/lib/ruby/gems/2.0.0/gems/retriable-3.1.2/lib/retriable.rb:61:in block in retriable'
from D:/Ruby/ruby gems/ruby/lib/ruby/gems/2.0.0/gems/retriable-3.1.2/lib/retriable.rb:56:in
times'
来自 D:/Ruby/ruby gems/ruby/lib/ruby/gems/2.0.0/gems/retriable-3.1.2/lib/retriable.rb:56:in retriable'
from D:/g_drive_local/BMajor/gems/google-api-ruby-client-0100/google-api-ruby-client-0.10.0/lib/google/apis/core/http_command.rb:96:in
execute'
来自 D:/g_drive_local/BMajor/gems/google-api-ruby-client-0100/google-api-ruby-client-0.10.0/lib/google/apis/core/base_service.rb:353:in execute_or_queue_command'
from D:/g_drive_local/BMajor/gems/google-api-ruby-client-0100/google-api-ruby-client-0.10.0/generated/google/apis/drive_v3/service.rb:579:in
create_file'
来自 D:/g_drive_local/BMajor/gems/google-drive-ruby-200/google-drive-ruby-2.0.0/lib/google_drive/session.rb:409:in upload_from_source'
from D:/g_drive_local/BMajor/gems/google-drive-ruby-200/google-drive-ruby-2.0.0/lib/google_drive/session.rb:308:in
upload_from_file'
来自(IRB):2
来自 D:/Ruby/ruby gems/ruby/lib/ruby/gems/2.0.0/gems/railties-4.0.4/lib/rails/commands/console.rb:90:in start'
from D:/Ruby/ruby gems/ruby/lib/ruby/gems/2.0.0/gems/railties-4.0.4/lib/rails/commands/console.rb:9:in
start'
来自 D:/Ruby/ruby gems/ruby/lib/ruby/gems/2.0.0/gems/railties-4.0.4/lib/rails/commands.rb:62:in <top (required)>'
from bin/rails:4:in
require'
来自 bin/rails:4:in `'
通过点击和试用,我自己解决了这个问题。 这就是我在 http_client_adapter.rb 中配置代理的方式:
def configure_client(client, request)
client.transparent_gzip_decompression = true
if true #request.options.proxy
#proxy = request.options.proxy
proxy = URI('http://proxy.xyz.com:8080')
proxy_user = '*******'
proxy_pass = '*******'
client.proxy = 'http://username:password@hostname:port'
if proxy_user && proxy_pass
client.set_proxy_auth proxy_user, proxy_pass
end
end
end