Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import os
|
2 |
import json
|
3 |
from google.oauth2 import service_account
|
|
|
4 |
|
5 |
from langchain.llms import OpenAI
|
6 |
from langchain.chat_models import ChatOpenAI
|
@@ -14,22 +15,15 @@ PROJECT_ID = "franz-media-1512554302520"
|
|
14 |
LOCATION = "us-central1"
|
15 |
CRED_PATH = "creds.json"
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
27 |
-
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/franz-media-1512554302520%40appspot.gserviceaccount.com",
|
28 |
-
"universe_domain": "googleapis.com"
|
29 |
-
})
|
30 |
-
|
31 |
-
with open(CRED_PATH,"w") as f:
|
32 |
-
f.write(creds)
|
33 |
|
34 |
print("stored")
|
35 |
|
|
|
1 |
import os
|
2 |
import json
|
3 |
from google.oauth2 import service_account
|
4 |
+
from cryptography.fernet import Fernet
|
5 |
|
6 |
from langchain.llms import OpenAI
|
7 |
from langchain.chat_models import ChatOpenAI
|
|
|
15 |
LOCATION = "us-central1"
|
16 |
CRED_PATH = "creds.json"
|
17 |
|
18 |
+
with open("key.json","w") as f:
|
19 |
+
encrypted_data = f.read()
|
20 |
+
|
21 |
+
cipher_suite = Fernet(os.environ["ENCRYPTION_KEY"])
|
22 |
+
decrypted_data = cipher_suite.decrypt(encrypted_data)
|
23 |
+
|
24 |
+
|
25 |
+
with open(CRED_PATH,"wb") as f:
|
26 |
+
f.write(decrypted_data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
print("stored")
|
29 |
|