Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
194 views
in Technique[技术] by (71.8m points)

python - Using Boto3 To Download From S3, where do I store it on Android using Kivy?

The following code works great with no issues on my PC.

import boto3


s3 = boto3.client('s3', aws_access_key_id='id', aws_secret_access_key='key')
with open('froms3.json', 'wb') as f:
    s3.download_fileobj('totals2', 'totals.json', f)

import json

with open('froms3.json', 'r') as datafile:
    data = json.loads(datafile.read())
    print(data)
    data2 = json.loads(data)
    data3 = (data2['HOME TEAM:'])
    data4 = (data2['AWAY TEAM:'])
    data5 = (data2['GAME POINTS WITH FORMULA:'])
    data6 = (list(dict.values(data3)))
    data7 = (list(dict.values(data4)))
    data8 = (list(dict.values(data5)))
    print(data6)
    print(data7)
    print(data8)

But it doesn't seem to work well when I package with Kivy, I know on PC the request would put that JSON file into the current directory, I am having a hard time understanding how Android handles that? I would think I want this data to go into the app data folder, do I specify that or should it work as written here and there is a local directory on android as well?

Thanks

question from:https://stackoverflow.com/questions/65928736/using-boto3-to-download-from-s3-where-do-i-store-it-on-android-using-kivy

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...