Trying to use scala-weather in a Spark Streaming app

hi everyone ,
can some one please help me how can i use openweathermap api for spark , kafka, cassandra streaming , i am done with normal stream , mean some dummy data from csv files now i want real time streaming, i found “” this one useful for getting data from openweathermap , but i am unable to find how to use this api , can any one please help me how can i use this api in order to get data for real time stream.If some one have example code for openweathermap , please do share.


Hi @matesio,

  1. You’ll need to get API key from OpenWeatherMap by signing up on their website
  2. Here’s brief post explaining scala-weather usage:
  3. Here’ brief explanation:
// Create client
val client = OwmAsyncClient(YOURKEY)
// Get weather by coordinates
val response = client.currentByCoords(35, 139)
response.onSuccess { weather =>

Above, response is standard Scala stdlib Future, and weather is Either-like datatype, which either successful OwmResponse (you can inspect this class in IDE) or failure if JSON for example cannot be parsed.

Aside from OwmAsyncClient there’s also blocking OwmCacheClient.

Thanks sir

[error] required: PartialFunction[scalaz./[,],?]
[error] response.onSuccess { weather =>
[error] ^
[error] one error found
[error] (compile:compileIncremental) Compilation failed
[error] Total time: 4 s, completed Jul 19, 2017 11:00:41 AM

It is giving me error