Advertisement
Tiberium

Untitled

Mar 23rd, 2017
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nim 0.51 KB | None | 0 0
  1. import httpclient
  2. import strutils
  3. import json
  4.  
  5. var http = newHttpClient()
  6.  
  7. proc getJson(url: string): JsonNode =
  8.     var content = http.getContent(url)
  9.     echo content
  10.     return parseJson(content)
  11.  
  12. proc getAPI(url: string): JSonNode =
  13.     var resp = getJson(url)["response"]
  14.     for k, v in resp.pairs():
  15.         echo $k
  16.         echo $v
  17.     return resp
  18.  
  19. proc getFirstAPI(url: string): JSonNode =
  20.     return getAPI(url)[0]
  21.  
  22. echo getFirstAPI("https://api.vk.com/method/users.get?user_id=170831732&v=5.52")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement