Spaces:
Sleeping
Sleeping
Jhon Alexander Alvarez Casas
commited on
Commit
·
80aff54
1
Parent(s):
cc2e026
upload login from save on supabase and new template for process order-creation
Browse files- main.py +1 -1
- template/b2b-order-creation +17 -0
main.py
CHANGED
|
@@ -25,7 +25,7 @@ def data(bucket: str, project: str, local_date: str, env_file: UploadFile = File
|
|
| 25 |
@app.get("/data")
|
| 26 |
async def data(project: str, local_date: str):
|
| 27 |
local_folder = f"data/{project}/{local_date}"
|
| 28 |
-
with open(f"template/
|
| 29 |
template = file.read()
|
| 30 |
template = template.replace("{{", "{{{{").replace("}}", "}}}}")
|
| 31 |
values = {"project": project, "local_date": local_date}
|
|
|
|
| 25 |
@app.get("/data")
|
| 26 |
async def data(project: str, local_date: str):
|
| 27 |
local_folder = f"data/{project}/{local_date}"
|
| 28 |
+
with open(f"template/b2b-order-creation", "r") as file:
|
| 29 |
template = file.read()
|
| 30 |
template = template.replace("{{", "{{{{").replace("}}", "}}}}")
|
| 31 |
values = {"project": project, "local_date": local_date}
|
template/b2b-order-creation
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<macro>
|
| 2 |
+
import hashlib
|
| 3 |
+
from datetime import datetime
|
| 4 |
+
def attrs(data):
|
| 5 |
+
project = "{project}"
|
| 6 |
+
local_date = "{local_date}"
|
| 7 |
+
key = project + "-" + local_date + "-" + data["ip"] + "-" + data["date"] + "-" + data["body"]
|
| 8 |
+
data["key"] = hashlib.sha256(key.encode()).hexdigest()
|
| 9 |
+
data["updated_at"] = datetime.now().isoformat()
|
| 10 |
+
data["process"] = "order-creation"
|
| 11 |
+
data["project"] = project
|
| 12 |
+
data["local_date"] = local_date
|
| 13 |
+
return data
|
| 14 |
+
</macro>
|
| 15 |
+
<group macro="attrs">
|
| 16 |
+
{{date}} ip-{{ip}}.ec2.internal /b2b/order/api/v1/creation with request body {{body | ORPHRASE}}
|
| 17 |
+
</group>
|