Moibe commited on
Commit
2ece5ff
·
verified ·
1 Parent(s): 23ee560

Novelty por Flag en main.py

Browse files
Files changed (1) hide show
  1. main.py +90 -90
main.py CHANGED
@@ -1,90 +1,90 @@
1
- from fastapi import FastAPI
2
- import funciones
3
-
4
- app = FastAPI()
5
-
6
- #Future: Correct warnings in cryptography.
7
-
8
- @app.get("/")
9
- def start():
10
-
11
- return {"Status":"Deployed"}
12
-
13
- ## GET DATA ##
14
-
15
- #Vía Path
16
- @app.get("/getData/")
17
- def getData():
18
- data = funciones.getData()
19
- print("Tipo de resultado:", type(data))
20
- return data
21
-
22
- #Vía Query
23
- #Quizá no es necesaria vía Query porque no pide parámetros.
24
- @app.get("/getDataQ/")
25
- def getData():
26
- data = funciones.getData()
27
- print("Tipo de resultado:", type(data))
28
- return data
29
-
30
-
31
- ## GET TOKENS ##
32
- #Vía Path
33
- @app.get("/getTokens/{userfile}")
34
- def getTokens(userfile: str):
35
- tokens = funciones.getTokens(userfile)
36
- print("Tipo de resultado:", type(tokens))
37
- return tokens
38
-
39
- #Vía Query
40
- @app.get("/getTokensQ/")
41
- def getTokens(userfile: str = "gAAAAABmEZA4SLBC2YczouOrjIEi9WNCNGOIvyUcqBUnzxNsftXTdy54KaX9x8mAjFkABSI6FJrdZDQKk_5lpJOgJoMChxlniw=="):
42
- tokens = funciones.getTokens(userfile)
43
- print("Tipo de resultado:", type(tokens))
44
- return tokens
45
-
46
- ## AUTHORIZE WORK ##
47
- #Vía Parameters
48
- @app.get("/authorize/{tokens}/{work}")
49
- def authorize(tokens: int, work: str):
50
- autorizacion = funciones.authorize(tokens, work)
51
- print("Tipo de resultado:", type(autorizacion))
52
- return autorizacion
53
-
54
- #Vía Query
55
- @app.get("/authorizeQ/")
56
- def authorize(tokens: int, work: str = "picswap"):
57
- autorizacion = funciones.authorize(tokens,work)
58
- print("Tipo de resultado:", type(autorizacion))
59
- return autorizacion
60
-
61
-
62
- ## DEBIT TOKENS ##
63
- #Vía Parámeters
64
- @app.get("/debitTokens/{userfile}/{work}")
65
- def debitTokens(userfile: str, work: str):
66
- tokens = funciones.debitTokens(userfile,work)
67
- print("Tipo de resultado:", type(tokens))
68
- return tokens
69
-
70
- #Vía Query
71
- @app.get("/debitTokensQ/")
72
- def debitTokens(userfile: str, work: str = "picswap"):
73
- tokens = funciones.debitTokens(userfile,work)
74
- print("Tipo de resultado:", type(tokens))
75
- return tokens
76
-
77
- ## GET USER FLAG ##
78
- #Vía Parámeters
79
- @app.get("/getUserFlag/{userfile}")
80
- def getUserFlag(userfile: str):
81
- flag = funciones.getUserFlag(userfile)
82
- print("Tipo de resultado:", type(flag))
83
- return flag
84
-
85
- #Vía Query
86
- @app.get("/getUserFlag/")
87
- def getUserFlag(userfile: str):
88
- flag = funciones.getUserFlag(userfile)
89
- print("Tipo de resultado:", type(flag))
90
- return flag
 
1
+ from fastapi import FastAPI
2
+ import funciones
3
+
4
+ app = FastAPI()
5
+
6
+ #Future: Correct warnings in cryptography.
7
+
8
+ @app.get("/")
9
+ def start():
10
+
11
+ return {"Status":"Deployed"}
12
+
13
+ ## GET DATA ##
14
+
15
+ #Vía Path
16
+ @app.get("/getData/")
17
+ def getData():
18
+ data = funciones.getData()
19
+ print("Tipo de resultado:", type(data))
20
+ return data
21
+
22
+ #Vía Query
23
+ #Quizá no es necesaria vía Query porque no pide parámetros.
24
+ @app.get("/getDataQ/")
25
+ def getData():
26
+ data = funciones.getData()
27
+ print("Tipo de resultado:", type(data))
28
+ return data
29
+
30
+
31
+ ## GET TOKENS ##
32
+ #Vía Path
33
+ @app.get("/getTokens/{userfile}")
34
+ def getTokens(userfile: str):
35
+ tokens = funciones.getTokens(userfile)
36
+ print("Tipo de resultado:", type(tokens))
37
+ return tokens
38
+
39
+ #Vía Query
40
+ @app.get("/getTokensQ/")
41
+ def getTokens(userfile: str = "gAAAAABmEZA4SLBC2YczouOrjIEi9WNCNGOIvyUcqBUnzxNsftXTdy54KaX9x8mAjFkABSI6FJrdZDQKk_5lpJOgJoMChxlniw=="):
42
+ tokens = funciones.getTokens(userfile)
43
+ print("Tipo de resultado:", type(tokens))
44
+ return tokens
45
+
46
+ ## AUTHORIZE WORK ##
47
+ #Vía Parameters
48
+ @app.get("/authorize/{tokens}/{work}")
49
+ def authorize(tokens: int, work: str):
50
+ autorizacion = funciones.authorize(tokens, work)
51
+ print("Tipo de resultado:", type(autorizacion))
52
+ return autorizacion
53
+
54
+ #Vía Query
55
+ @app.get("/authorizeQ/")
56
+ def authorize(tokens: int, work: str = "picswap"):
57
+ autorizacion = funciones.authorize(tokens,work)
58
+ print("Tipo de resultado:", type(autorizacion))
59
+ return autorizacion
60
+
61
+
62
+ ## DEBIT TOKENS ##
63
+ #Vía Parámeters
64
+ @app.get("/debitTokens/{userfile}/{work}")
65
+ def debitTokens(userfile: str, work: str):
66
+ tokens = funciones.debitTokens(userfile,work)
67
+ print("Tipo de resultado:", type(tokens))
68
+ return tokens
69
+
70
+ #Vía Query
71
+ @app.get("/debitTokensQ/")
72
+ def debitTokens(userfile: str, work: str = "picswap"):
73
+ tokens = funciones.debitTokens(userfile,work)
74
+ print("Tipo de resultado:", type(tokens))
75
+ return tokens
76
+
77
+ ## GET USER FLAG ##
78
+ #Vía Parámeters
79
+ @app.get("/getUserNovelty/{userfile}")
80
+ def getUserFlag(userfile: str):
81
+ novelty = funciones.getUserNovelty(userfile)
82
+ print("Tipo de resultado:", type(novelty))
83
+ return novelty
84
+
85
+ #Vía Query
86
+ @app.get("/getUserFlag/")
87
+ def getUserNovelty(userfile: str):
88
+ novelty = funciones.getUserNovelty(userfile)
89
+ print("Tipo de resultado:", type(novelty))
90
+ return novelty