Junaidb commited on
Commit
f12c8de
·
verified ·
1 Parent(s): 212618b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -4
app.py CHANGED
@@ -2,6 +2,14 @@ from fastapi import FastAPI,Request,HTTPException,Response
2
  from pydantic import BaseModel
3
  from fastapi.responses import JSONResponse
4
  from components.mongodbconnection import provideClient
 
 
 
 
 
 
 
 
5
 
6
  app=FastAPI()
7
  client=provideClient()
@@ -11,6 +19,18 @@ coll=db["agentpaymentcol"]
11
 
12
 
13
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  def load_keypair(agent):
15
 
16
  documents=coll.find_one({"owner":"system"})
@@ -29,9 +49,22 @@ def load_keypair(agent):
29
  return keypair.pubkey()
30
 
31
 
32
- @app.get("/")
33
- def Auth401(request:Request):
34
- return {"token":""}
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
 
37
  @app.get("/agent/{id}")
@@ -39,4 +72,3 @@ def getAgentKey(id):
39
  pkey=load_keypair(id)
40
  return {"wallet":pkey}
41
 
42
-
 
2
  from pydantic import BaseModel
3
  from fastapi.responses import JSONResponse
4
  from components.mongodbconnection import provideClient
5
+ from components.agentcreation import VelocityPayableAgent
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
 
14
  app=FastAPI()
15
  client=provideClient()
 
19
 
20
 
21
 
22
+
23
+
24
+
25
+
26
+
27
+
28
+ class Agent(BaseModel):
29
+ agent_id:str
30
+
31
+
32
+
33
+
34
  def load_keypair(agent):
35
 
36
  documents=coll.find_one({"owner":"system"})
 
49
  return keypair.pubkey()
50
 
51
 
52
+
53
+
54
+ @app.post("/init_agent")
55
+ def Agent(request:Request):
56
+
57
+ try:
58
+ velocitypayableinstance=VelocityPayableAgent()
59
+ velocitypayableinstance.Agentinit()
60
+ return True
61
+ except Exception as e:
62
+ return False
63
+
64
+
65
+
66
+
67
+
68
 
69
 
70
  @app.get("/agent/{id}")
 
72
  pkey=load_keypair(id)
73
  return {"wallet":pkey}
74