parse token from int or str (#405)
This commit is contained in:
parent
a859943871
commit
669aa2cd8b
|
@ -36,11 +36,13 @@ proc fetchToken(): Future[Token] {.async.} =
|
|||
|
||||
var
|
||||
resp: string
|
||||
tokNode: JsonNode
|
||||
tok: string
|
||||
|
||||
try:
|
||||
resp = clientPool.use(headers): await c.postContent(activate)
|
||||
tok = parseJson(resp)["guest_token"].getStr
|
||||
tokNode = parseJson(resp)["guest_token"]
|
||||
tok = tokNode.getStr($(tokNode.getInt))
|
||||
|
||||
let time = getTime()
|
||||
result = Token(tok: tok, remaining: 187, reset: time + resetPeriod,
|
||||
|
|
Loading…
Reference in New Issue