Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import dispatch._, Defaults._
- import scala.concurrent.Await
- import scala.concurrent.duration._
- object Main extends App {
- val h = host("maps.googleapis.com")
- val req = h / "maps" / "api" / "distancematrix" / "xml"
- def params(origins: String, destinations: String) =
- req <<? Map("origins" -> origins,
- "destinations" -> destinations,
- "language" -> "pl")
- def distanceMatrix(origins: String, destinations: String): xml.Elem = {
- val http = new Http
- val futureDM: Future[xml.Elem] = http(params(origins, destinations) OK as.xml.Elem)
- val dm = Await.result(futureDM, 5.seconds)
- http.shutdown()
- dm
- }
- println(distanceMatrix("Berlin", "London"))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement