Google将很快退出Latitude以及Latitude的API.但他们在他们的博客上表示,仍将存储位置记录,用户将能够在Google地图的位置历史记录仪表板上访问他们的历史记录.您知道是否有任何用于接收该位置记录的API,就像谷歌纵横一样?
我试图让Oauth使用Python使用Google API.我尝试了不同的oauth库,如oauth,oauth2和djanog-oauth,但我无法使其工作(包括提供的示例).
为了调试Oauth,我使用了Google的Oauth Playground,我研究了API和Oauth文档
对于一些库我正在努力获得正确的签名,与其他库我正在努力将请求令牌转换为授权令牌.如果有人可以使用上述库之一向我展示Google API的工作示例,那将对我有什么帮助.
编辑:我的初步问题没有得到任何答案,所以我添加了我的代码.导致此代码无效的原因有两种:
1)Google未授权我的请求令牌,但不太确定如何检测此
签名2)访问令牌的签名无效但我想了解哪些oauth参数Google因为我能够在第一阶段产生适当的签名.
这是使用oauth2.py和Django编写的,因此是HttpResponseRedirect.
REQUEST_TOKEN_URL = 'https://www.google.com/accounts/OAuthGetRequestToken'
AUTHORIZATION_URL = 'https://www.google.com/accounts/OAuthAuthorizeToken'
ACCESS_TOKEN_URL = 'https://www.google.com/accounts/OAuthGetAccessToken'
CALLBACK = 'http://localhost:8000/mappr/mappr/oauth/' #will become real server when deployed
OAUTH_CONSUMER_KEY = 'anonymous'
OAUTH_CONSUMER_SECRET = 'anonymous'
signature_method = oauth.SignatureMethod_HMAC_SHA1()
consumer = oauth.Consumer(key=OAUTH_CONSUMER_KEY, secret=OAUTH_CONSUMER_SECRET)
client = oauth.Client(consumer)
request_token = oauth.Token('','') #hackish way to be able to access the token in different functions, I know this is bad, but I just want it …Run Code Online (Sandbox Code Playgroud) 我正在编写一个访问Google AnalyticsAPI的Ruby应用程序来提取一些实验信息.
该应用通过以下功能使用Google服务帐户进行连接和身份验证:
def connect
...
@@client = Google::APIClient.new(:application_name => 'My Service App',
:application_version => '1.0.0')
key_file = Rails.root.join('config', 'privatekey.p12').to_s
key_secret = 'somesecret'
key = Google::APIClient::PKCS12.load_key(key_file, key_secret)
asserter = Google::APIClient::JWTAsserter.new(
SECRETS[:google_service_account_email],
['https://www.googleapis.com/auth/yt-analytics.readonly',
'https://www.googleapis.com/auth/analytics.readonly'
],
key
)
@@client.authorization = asserter.authorize()
...
end
Run Code Online (Sandbox Code Playgroud)
...对API进行身份验证和发现,没有问题.
针对YouTube Analytics API使用客户端可以正常运行.使用相同的帐户通过...访问Analytics API
response = @@client.execute({
# 'analytics is the API object retrieved via discover_api()
:api_method => analytics.management.experiments.list,
:parameters => {
'accountId' => 'AAAAAAAA',
'profileId' => 'PPPPPPPP',
'webPropertyId' => 'UA-WWWWWWWW-#'
}
})
Run Code Online (Sandbox Code Playgroud)
结果出现403错误响应:
{"domain":"global","reason":"insufficientPermissions","message":"User does not have …Run Code Online (Sandbox Code Playgroud) google-analytics google-api google-analytics-api google-api-client
有没有办法使用API将图层,点,方向或任何数据添加到Google我的地图中的地图上?
我在谷歌搜索过,但没有找到解决办法.
需要有关通过api将文件插入谷歌驱动器的帮助.用于此目的的api文档没有清楚地解释如何通过http post请求发送文件的实际主体.
我在连接到google drive API时在我的localhost上收到此控制台错误,但我在脚本中配置的选择器成功显示了我的驱动器内容:
无法在'DOMWindow'上执行'postMessage':提供的目标来源(' https://docs.google.com ')与收件人窗口的来源(' http:// localhost:8000 ')不匹配.
加载" https://docs.google.com/picker?protocol=gadgets&origin=http%3A%2F%2Flocalho ... 2photos%22))&rpctoken = yxxydsx40r21&rpcService = 2dngvfb4tj9x&thirdParty = true" 时遇到无效的"X-Frame-Options"标题:'ALLOW-FROM http:// localhost:8000 '不是公认的指令.标题将被忽略.
我是否会忽略这一点,还是会给我带来麻烦?
我在 Python Quickstart下运行 quickstart.py 示例代码,但出现以下错误:
ValueError:客户端机密必须用于 Web 或已安装的应用程序。
我创建了一个credentials.json具有项目所有者权限的文件。
错误发生在以下代码段中:
if os.path.exists('token.pickle'):
with open('token.pickle', 'rb') as token:
creds = pickle.load(token)
# If there are no (valid) credentials available, let the user log in.
if not creds or not creds.valid:
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
else:
flow = InstalledAppFlow.from_client_secrets_file('credentials.json', SCOPES)
creds = flow.run_local_server()
# Save the credentials for the next run
with open('token.pickle', 'wb') as token:
pickle.dump(creds, token)
Run Code Online (Sandbox Code Playgroud)
我还注意到没有创建 token.pickle 文件。这是错误输出:
File "updateSlidev01.py", line 51, in …Run Code Online (Sandbox Code Playgroud) 我已经开始使用Google+ APIfor android了,我已经按照本教程创建了一个登录应用程序:
https://developers.google.com/+/mobile/android/sign-in
现在,问题是我想从一个不同的创建注销按钮Activity,我试图做的事情并没有真正起作用..
我的GPlusLogin代码(Google+登录活动):
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.IntentSender.SendIntentException;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import com.google.android.gms.common.*;
import com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks;
import com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener;
import com.google.android.gms.plus.PlusClient;
public class GPlusLogin extends Activity implements ConnectionCallbacks, OnConnectionFailedListener{
private static final int REQUEST_CODE_RESOLVE_ERR = 9000;
private static final String TAG = "GPlusLogin";
private ProgressDialog mConnectionProgressDialog;
private PlusClient mPlusClient;
private ConnectionResult mConnectionResult;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.gplus_layout);
mPlusClient = …Run Code Online (Sandbox Code Playgroud) 对于OAuth服务器授予的离线访问,"离线"一词到底意味着什么?
这是否意味着即使用户退出第三方应用程序或用户从OAuth资源服务器(如Facebook或Google或Twitter)注销,资源服务器也将返回有关用户的数据?
使用Gmail API.我的客户端密码文件已下载并适用于Ruby.当我尝试quickstart.py(python)版本时,我收到此错误
File "quickstart.py", line 70, in <module>
main()
File "quickstart.py", line 55, in main
credentials = get_credentials()
File "quickstart.py", line 38, in get_credentials
credentials = store.get()
File "/Library/Python/2.7/site-packages/oauth2client/client.py", line 374, in get
return self.locked_get()
File "/Library/Python/2.7/site-packages/oauth2client/file.py", line 79, in locked_get
credentials = Credentials.new_from_json(content)
File "/Library/Python/2.7/site-packages/oauth2client/client.py", line 281, in new_from_json
module = data['_module']
KeyError: '_module'
Run Code Online (Sandbox Code Playgroud)
我根本没有更改文件,只是将client_secret.json添加到该工作目录并安装了google-api-python-client.我的python代码来自这里:https://developers.google.com/gmail/api/quickstart/python
google-api ×10
python ×3
google-maps ×2
oauth ×2
android ×1
api ×1
django ×1
drive ×1
gmail-api ×1
google-oauth ×1
google-plus ×1
javascript ×1
mymaps ×1