无法使用Python从MySQL数据库中获取数据

时间:2015-10-12 23:17:15

标签: python mysql

我试图编写一个从XBee接收数据然后将数据上传到数据库的程序。该程序是用Python编写的。我得到了XBee部分,但是当我尝试执行SQL命令时,我得到了一个错误。

以下是代码:

Database version : 5.6.26 
Error: unable to fecth data
S1

当我运行程序时,我得到了这个:

# service-account.py

import json
from oauth2client.client import SignedJwtAssertionCredentials

# The scope for the OAuth2 request.
SCOPE = 'https://www.googleapis.com/auth/analytics.readonly'

# The location of the key file with the key data.
KEY_FILEPATH = 'path/to/json-key.json'

# Load the key file's private data.
with open(KEY_FILEPATH) as key_file:
  _key_data = json.load(key_file)

# Construct a credentials objects from the key data and OAuth2 scope.
_credentials = SignedJwtAssertionCredentials(
    _key_data['client_email'], _key_data['private_key'], SCOPE)

# Defines a method to get an access token from the credentials object.
# The access token is automatically refreshed if it has expired.
def get_access_token():
  return _credentials.get_access_token().access_token

0 个答案:

没有答案