Created
January 20, 2014 01:57
-
-
Save levinotik/8513701 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private def getForecast:Try[JsValue] = { | |
val ts = date.getTime / 1000 | |
val u = { | |
if (date == new Date()) new URL(s"https://api.forecast.io/forecast/$apiKey/$lat,$lon?units=$units") | |
else new URL(s"https://api.forecast.io/forecast/$apiKey/$lat,$lon,$ts?units=$units") | |
} | |
val s = new Scanner(u.openStream(), "UTF-8") | |
Try{s.useDelimiter("\\A").next().asJson} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment