From b2b46a77c1ab7a67bf94879762c46783f11c84fc Mon Sep 17 00:00:00 2001 From: ronreg-ribdev <56719257+ronreg-ribdev@users.noreply.github.com> Date: Thu, 21 May 2020 04:09:24 -0700 Subject: [PATCH] Start making requester for bart stations --- urbit/app/bartinfo.hoon | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/urbit/app/bartinfo.hoon b/urbit/app/bartinfo.hoon index 1dced9d..624ef86 100644 --- a/urbit/app/bartinfo.hoon +++ b/urbit/app/bartinfo.hoon @@ -93,6 +93,9 @@ :: :: request to http://api.bart.gov/api/stn.aspx?cmd=stns&key=Q5RQ-PUEB-999T-DWEI&json=y :: get .root | .stations | .station for list of stations + +++ bart-api-key "Q5RQ-PUEB-999T-DWEI" +++ bart-api-url-base "http://api.bart.gov/api" ++ poke-handle-http-request |= =inbound-request:eyre ^- simple-payload:http @@ -116,7 +119,20 @@ |= ~ ^- json %- pairs:enjs:format - :~ success+b+%.n + :~ + success+b+%.n == +++ request-bart-stations + ^- request:http + =/ url (crip "{bart-api-url-base}/stn.aspx?cmd=stns&key={bart-api-key}&json=y") + =/ headers [['Accept' 'application/json']]~ + [%'GET' url headers *(unit octs)] +::;++ request-darksky +:: |= location=@t +:: ^- request:http +:: =/ base 'https://api.darksky.net/forecast/634639c10670c7376dc66b6692fe57ca/' +:: =/ url=@t (cat 3 (cat 3 base location) '?units=auto') +:: =/ hed [['Accept' 'application/json']]~ +:: [%'GET' url hed *(unit octs)] :: --