首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >google pubsub中的代理设置

google pubsub中的代理设置
EN

Stack Overflow用户
提问于 2017-02-21 18:00:21
回答 1查看 850关注 0票数 0

我使用下面的示例代码从python脚本连接google pubsub。我的组织使用代理连接到互联网。您能告诉我如何在google云中配置代理设置吗?我尝试设置HTTP_PROXY环境变量,但仍然失败。

代码语言:javascript
复制
import json
from oauth2client.contrib.gce import AppAssertionCredentials
from oauth2client.service_account import ServiceAccountCredentials
from httplib2 import Http
from apiclient.discovery import build

credentials =          AppAssertionCredentials('https://www.googleapis.com/auth/pubsub')
scopes = ['https://www.googleapis.com/auth/pubsub', ' https://www.googleapis.com/auth/cloud-platform','https://www.googleapis.com/auth/monitoring', 'https://www.googleapis.com/auth/monitoring.write' ,'https://www.googleapis.com/auth/cloud-platform' , 'https://www.googleapis.com/auth/monitoring.read']
credentials = ServiceAccountCredentials.from_json_keyfile_name('path to json file', scopes=scopes)
http_auth = credentials.authorize(Http())
pubsub1 = build('pubsub', 'v1',http=http_auth)
EN

回答 1

Stack Overflow用户

发布于 2017-02-23 17:55:05

它是通过使用以下命令来工作的:

代码语言:javascript
复制
http_auth = credentials.authorize(Http(proxy_info =     httplib2.ProxyInfo(httplib2.socks.PROXY_TYPE_HTTP_NO_TUNNEL, 'proxy url wihout     http://', 8080, proxy_user = '', proxy_pass = '') ))

而不是Http=credentials.authorize( http_auth ())

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42364160

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档