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
|
var
|
||||||
resp: string
|
resp: string
|
||||||
|
tokNode: JsonNode
|
||||||
tok: string
|
tok: string
|
||||||
|
|
||||||
try:
|
try:
|
||||||
resp = clientPool.use(headers): await c.postContent(activate)
|
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()
|
let time = getTime()
|
||||||
result = Token(tok: tok, remaining: 187, reset: time + resetPeriod,
|
result = Token(tok: tok, remaining: 187, reset: time + resetPeriod,
|
||||||
|
|
Loading…
Reference in New Issue