File size: 1,890 Bytes
1473494
c51594b
1473494
 
 
 
88c4a76
1473494
4346b78
 
2070c08
 
 
 
f1c20f6
e5f9727
 
2070c08
 
 
 
a10f224
2070c08
f1c20f6
2070c08
 
 
 
 
a500260
 
 
c51594b
 
a500260
c2f4f33
c51594b
4346b78
a500260
88c4a76
 
a500260
88c4a76
 
 
a500260
 
 
 
f1c20f6
a500260
 
 
 
 
 
f1c20f6
a500260
 
a0e8f17
a500260
 
 
 
 
c51594b
 
88c4a76
 
 
 
a500260
88c4a76
 
c51594b
c2f4f33
c51594b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
from fastapi import FastAPI
import funciones

app = FastAPI()

@app.get("/")
def start(): 

    return {"Status":"Deployed"}

## GET DATA ##

#Vía Path
@app.get("/getData/")
def getData():
    data = funciones.getData()
    
    print("Tipo de resultado:", type(data))
    return data

#Vía Query 
#Quizá no es necesaria vía Query porque no pide parámetros.
@app.get("/getDataQ/")
def getData():
    data = funciones.getData()
    print("Tipo de resultado:", type(data))
    return data


## GET TOKENS ##

#Vía Path
@app.get("/getTokens/{userfile}")
def getTokens(userfile: str):
    tokens = funciones.getTokens(userfile)
    print("Tipo de resultado:", type(tokens))
    return tokens

#Vía Query 
@app.get("/getTokensQ/")
def getTokens(userfile: str = "gAAAAABmEZA4SLBC2YczouOrjIEi9WNCNGOIvyUcqBUnzxNsftXTdy54KaX9x8mAjFkABSI6FJrdZDQKk_5lpJOgJoMChxlniw=="):
    tokens = funciones.getTokens(userfile)
    print("Tipo de resultado:", type(tokens))
    return tokens

## AUTHORIZE WORK ##

#Vía Parameters
@app.get("/authorize/{tokens}/{work}")
def authorize(tokens: int, work: str):
    autorizacion = funciones.authorize(tokens, work)
    print("Tipo de resultado:", type(autorizacion))
    return autorizacion

#Vía Query
@app.get("/authorizeQ/")
def authorize(tokens: int, work: str = "picswap"):
    autorizacion = funciones.authorize(tokens,work) 
    print("Tipo de resultado:", type(autorizacion))
    return autorizacion


## DEBIT TOKENS ##

#Vía Parámeters
@app.get("/debitTokens/{userfile}/{work}")
def debitTokens(userfile: str, work: str):
    tokens = funciones.debitTokens(userfile,work) 
    print("Tipo de resultado:", type(tokens))
    return tokens

#Vía Query
@app.get("/debitTokensQ/")
def debitTokens(userfile: str, work: str = "picswap"):
    tokens = funciones.debitTokens(userfile,work) 
    print("Tipo de resultado:", type(tokens))
    return tokens