I recall installing the packages, but how to import them through Google search was not considered. I went to the docs and don’t see there either. I appreciate if you have a direct link to your solution. Appreciate
OK, I have implemented the above Randy and I unfortunately having a bear of a time with the Cloud approach. My local is working perfectly and I have gone to the website to drop in the secret_file info. Can I provide you a link to my site for your observation? I would certainly appreciate it.
I am getting this following error…"Traceback:
File “/home/appuser/venv/lib/python3.7/site-packages/streamlit/script_runner.py”, line 354, in _run_script
File “/app/pocket_option-strategy-analyzer/app.py”, line 26, in
File “/home/appuser/venv/lib/python3.7/site-packages/google/oauth2/service_account.py”, line 239, in from_service_account_file
filename, require=[“client_email”, “token_uri”]
File “/home/appuser/venv/lib/python3.7/site-packages/google/auth/_service_account_info.py”, line 72, in from_filename
with io.open(filename, “r”, encoding=“utf-8”) as json_file:
I thought I would look for a working example of this scenario in the community and it does not appear to be anywhere even as a effort. I see the effort for using Google Sheets, but not on the Streamlit Cloud Share, just in the docs with a localhost implementation.
Successfully installed cachetools-4.2.4 certifi-2021.10.8 charset-normalizer-2.0.7 google-api-core-2.2.2 google-api-python-client-2.31.0 google-auth-2.3.3 google-auth-httplib2-0.1.0 google-auth-oauthlib-0.4.6 googleapis-common-protos-1.53.0 httplib2-0.20.2 idna-3.3 oauthlib-3.1.1 protobuf-3.19.1 pyasn1-0.4.8 pyasn1-modules-0.2.8 pyparsing-3.0.6 requests-2.26.0 requests-oauthlib-1.3.0 rsa-4.7.2 setuptools-59.1.1 six-1.16.0 uritemplate-4.1.1 urllib3-1.26.7
WARNING: You are using pip version 21.1.1; however, version 21.3.1 is available.
You should consider upgrading via the '/home/appuser/venv/bin/python -m pip install --upgrade pip' command.
[manager] Python dependencies were installed from /app/pocket_option-strategy-analyzer/requirements.txt using pip.
[manager] Processed dependencies!
2021-11-17 15:51:58.871 Uncaught app exception
Traceback (most recent call last):
File "/home/appuser/venv/lib/python3.7/site-packages/streamlit/script_runner.py", line 354, in _run_script
File "/app/pocket_option-strategy-analyzer/app.py", line 26, in <module>
File "/home/appuser/venv/lib/python3.7/site-packages/google/oauth2/service_account.py", line 239, in from_service_account_file
filename, require=["client_email", "token_uri"]
File "/home/appuser/venv/lib/python3.7/site-packages/google/auth/_service_account_info.py", line 72, in from_filename
with io.open(filename, "r", encoding="utf-8") as json_file:
FileNotFoundError: [Errno 2] No such file or directory: 'keys.json'
The library is trying to read a file that doesn’t exist in your Git repo. I would guess it’s this line here:
Thanks for your insight on this. It’s getting pretty exciting to be approaching the finish line on this.
Please clarify this view of where I am currently at.
I see where you can place secrets for a local .streamlit folder, however for a Cloud hosting I don’t see how to hide the key.json file in GitHub. I am thinking to just upload the .streamlit folder and reference the file?
Do you have a example of what this looks like in the docs ?
You wouldn’t commit the file to GitHub, because then the values would be publicly accessible to anyone. Instead, you use the secrets management piece to pass in those values.
What this implies though is that you’ll likely need to change the method you use for your authentication (that I highlighted before), not to read from a file but instead pass those arguments directly. In your Python code, you would call the secret value (so it wouldn’t be accessible to everyone), but Python would swap in those values and make your app work.
OK, I see what you are saying, but how to implement is really challenging for me. So I currently have a variable (SERVICE_ACCOUNT_FILE) holding the path of where my file is.
This path is being used in a function,
creds = service_account.Credentials.from_service_account_file(SERVICE_ACCOUNT_FILE, scopes=SCOPES)
How do I pass the different components within the file to the places they being used in the function.
I am glad you are helping me to see the issue. I am starting to see the problem, but how to apply your solution is beyond me. lol Hint please…
Oh, now I hear what you are saying, but is that a Oautho2 approach ? What method can work for this type of challenge ?
To me this sounds like a totally different Python Library to build out the code.
Or is it a simple adjustment of existing code ?
This also appears to need a .toml file, not a .json file. Am I on the write track with this ? I do appreciate your thoughts, because I was a little challenged with this and not sure if I needed to scrap my code and build from scratch or if there is a way to make this work with a minor adjustment to existing code. I am scratching my head, lol