当我尝试使用python脚本将文件上传到GCP时出现错误

时间:2019-06-24 07:44:27

标签: python google-cloud-platform

我尝试使用以下python脚本将文件上传到我的Google云存储桶。但是这样做时出现以下错误。我该怎么解决?

from google.cloud import storage
client = storage.Client.from_service_account_json('key.json')

def upload_blob(bucket_name, blob_name, filename):
    """ 
       Upload a blob to the bucket. 
       filename: source file name
       blob_name: destination blob name
    """
    bucket = client.get_bucket(bucket_name)
    blob = bucket.blob(blob_name)
    blob.upload_from_filename(filename)

upload_blob("synersense_data","patient_data","schema.txt")

这是下面的错误:

google.auth.exceptions.RefreshError: ('invalid_grant: Invalid JWT: Token must be a short-lived token (60 minutes) and in a reasonable timeframe. Check your iat and exp values and use a clock with skew to account for clock differences between systems.', '{\n  "error": "invalid_grant",\n  "error_description": "Invalid JWT: Token must be a short-lived token (60 minutes) and in a reasonable timeframe. Check your iat and exp values and use a clock with skew to account for clock differences between systems."\n}')

0 个答案:

没有答案