starting to add pwgen
This commit is contained in:
parent
0650f4c957
commit
a97f3738b2
2 changed files with 30 additions and 0 deletions
13
pw_generaturr/pw_generaturr.nimble
Normal file
13
pw_generaturr/pw_generaturr.nimble
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# Package
|
||||||
|
|
||||||
|
version = "0.1.0"
|
||||||
|
author = "Paul Wilde"
|
||||||
|
description = "A new awesome nimble package"
|
||||||
|
license = "AGPL-3.0-or-later"
|
||||||
|
srcDir = "src"
|
||||||
|
bin = @["pw_generaturr"]
|
||||||
|
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
|
||||||
|
requires "nim >= 2.0.0"
|
17
pw_generaturr/src/pw_generaturr.nim
Normal file
17
pw_generaturr/src/pw_generaturr.nim
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
import ../../globurrl
|
||||||
|
|
||||||
|
import httpclient
|
||||||
|
import json
|
||||||
|
|
||||||
|
proc getPW() =
|
||||||
|
var c = newHttpClient()
|
||||||
|
try:
|
||||||
|
let resp = c.get("https://random-word-api.herokuapp.com/word?length=5")
|
||||||
|
if resp.status == $Http200:
|
||||||
|
echo resp.body.parseJson
|
||||||
|
|
||||||
|
except:
|
||||||
|
echo getCurrentExceptionMsg()
|
||||||
|
|
||||||
|
if isMainModule:
|
||||||
|
getPW()
|
Loading…
Reference in a new issue