Jon Solow
commited on
Commit
·
8344de9
1
Parent(s):
a714d79
Attempt json loads on the private key in hf
Browse files- src/login.py +10 -1
src/login.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import hmac
|
|
|
2 |
import streamlit as st
|
3 |
from streamlit_gsheets import GSheetsConnection
|
4 |
from streamlit.runtime.secrets import AttrDict, secrets_singleton
|
@@ -17,7 +18,15 @@ class HFFriendlyGSheetsConnection(GSheetsConnection):
|
|
17 |
"""
|
18 |
connections_section = None
|
19 |
if secrets_singleton.load_if_toml_exists():
|
20 |
-
connections_section = secrets_singleton
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
return AttrDict(connections_section)
|
23 |
|
|
|
1 |
import hmac
|
2 |
+
import json
|
3 |
import streamlit as st
|
4 |
from streamlit_gsheets import GSheetsConnection
|
5 |
from streamlit.runtime.secrets import AttrDict, secrets_singleton
|
|
|
18 |
"""
|
19 |
connections_section = None
|
20 |
if secrets_singleton.load_if_toml_exists():
|
21 |
+
connections_section = AttrDict(secrets_singleton)
|
22 |
+
|
23 |
+
# in hf env the private key may need json loads
|
24 |
+
private_key = connections_section["private_key"]
|
25 |
+
try:
|
26 |
+
private_key = json.loads(private_key)
|
27 |
+
connections_section["private_key"] = private_key
|
28 |
+
except Exception:
|
29 |
+
pass
|
30 |
|
31 |
return AttrDict(connections_section)
|
32 |
|