Skip to content

Commit

Permalink
finalized some more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hitblast committed Jun 29, 2023
1 parent 54cb60d commit 0ecf60f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/nimippkg/main.nim
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,12 @@ proc refreshData*(self: IPRef): Future[void] {.async.} =
raise IPDefect.newException(fmt"Query failed for IP {query}: '{message}'")

else:
data = some(parsed)
self.remainingRequests = parseInt(toString(response.headers["X-Rl"]))
self.timeUntilReset = parseInt(toString(response.headers["X-Ttl"]))
proc getParsedHeader(key: string): int =
return parseInt(toString(response.headers[key]))

data = some(parsed)
self.remainingRequests = getParsedHeader("X-Rl")
self.timeUntilReset = getParsedHeader("X-Ttl")

proc retrieveData(self: IPRef, key: string): JsonNode =
## Returns the value of a provided key within the initialized data. Returned in JsonNode.
Expand Down

0 comments on commit 0ecf60f

Please sign in to comment.