Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
github.com/vascocosta/owm
Package owm implements a wrapper for the Open Weather Map API.
Read more about the original API here: http://openweathermap.org/api.
go get github.com/vascocosta/owm
godoc github.com/vascocosta/owm
Read it online here: http://godoc.org/github.com/vascocosta/owm.
package main
import (
"fmt"
"github.com/vascocosta/owm"
"log"
)
func main() {
// Create a new Client given an API key.
c := owm.NewClient("YOUR_OPEN_WEATHER_MAP_API_KEY")
// Decode the current weather of a location given the city name and
// units. WeatherByName returns a Weather.
w, err := c.WeatherByName("Lisbon", "metric")
// If there is an error, print it and terminate the program.
if err != nil {
log.Fatal(err)
}
// Print a string representation of w using the Stringer interface.
fmt.Println(&w)
}
package main
import (
"fmt"
"github.com/vascocosta/owm"
"log"
)
func main() {
// Create a new Client given an API key.
c := owm.NewClient("YOUR_OPEN_WEATHER_MAP_API_KEY")
// Decode the current weather of a location given the city id and
// units. WeatherById returns a Weather.
w, err := c.WeatherById(2267057, "metric")
// If there is an error, print it and terminate the program.
if err != nil {
log.Fatal(err)
}
// Print a string representation of w using the Stringer interface.
fmt.Println(&w)
}
package main
import (
"fmt"
"github.com/vascocosta/owm"
"log"
)
func main() {
// Create a new Client given an API key.
c := owm.NewClient("YOUR_OPEN_WEATHER_MAP_API_KEY")
// Decode the current weather of a location given the city coordinates
// and units. WeatherByCoord returns a Weather.
w, err := c.WeatherByCoord(38.72, -9.13, "metric")
// If there is an error, print it and terminate the program.
if err != nil {
log.Fatal(err)
}
// Print a string representation of w using the Stringer interface.
fmt.Println(&w)
}
package main
import (
"fmt"
"github.com/vascocosta/owm"
"log"
)
func main() {
// Create a new Client given an API key.
c := owm.NewClient("YOUR_OPEN_WEATHER_MAP_API_KEY")
// Decode the current weather of multiple locations given the zone
// coordinates, map zoom and units. WeatherByZone returns a []Weather.
w, err := c.WeatherByZone(12, 32, 15, 37, 10, "metric")
// If there is an error, print it and terminate the program.
if err != nil {
log.Fatal(err)
}
// Print a string representation of w using the Stringer interface.
for i := range w {
fmt.Println(&w[i])
}
}
package main
import (
"fmt"
"github.com/vascocosta/owm"
"log"
)
func main() {
// Create a new Client given an API key.
c := owm.NewClient("YOUR_OPEN_WEATHER_MAP_API_KEY")
// Decode the current weather of multiple locations given the center
// coordinates, radius and units. WeatherByRadius returns a []Weather.
w, err := c.WeatherByRadius(38.72, -9.13, 10, "metric")
// If there is an error, print it and terminate the program.
if err != nil {
log.Fatal(err)
}
// Print a string representation of w using the Stringer interface.
for i := range w {
fmt.Println(&w[i])
}
}
package main
import (
"fmt"
"github.com/vascocosta/owm"
"log"
)
func main() {
// Create a new Client given an API key.
c := owm.NewClient("YOUR_OPEN_WEATHER_MAP_API_KEY")
// Decode the current weather of multiple locations given a slice of
// city ids and units. WeatherByIds returns a []Weather.
w, err := c.WeatherByIds([]int{2267057, 2735943, 2268339}, "metric")
// If there is an error, print it and terminate the program.
if err != nil {
log.Fatal(err)
}
// Print a string representation of w using the Stringer interface.
for i := range w {
fmt.Println(&w[i])
}
}
package main
import (
"fmt"
"github.com/vascocosta/owm"
"log"
)
func main() {
// Create a new Client given an API key.
c := owm.NewClient("YOUR_OPEN_WEATHER_MAP_API_KEY")
// Decode the current forecast of a location given the city name, days
// and units. ForecastByName returns a Forecast.
f, err := c.ForecastByName("Lisbon", 4, "metric")
// If there is an error, print it and terminate the program.
if err != nil {
log.Fatal(err)
}
// Print a string representation of f using the Stringer interface.
fmt.Println(&f)
}
package main
import (
"fmt"
"github.com/vascocosta/owm"
"log"
)
func main() {
// Create a new Client given an API key.
c := owm.NewClient("YOUR_OPEN_WEATHER_MAP_API_KEY")
// Decode the current forecast of a location given the city id, days
// and units. ForecastById returns a Forecast.
f, err := c.ForecastById(2267057, 8, "metric")
// If there is an error, print it and terminate the program.
if err != nil {
log.Fatal(err)
}
// Print a string representation of f using the Stringer interface.
fmt.Println(&f)
}
package main
import (
"fmt"
"github.com/vascocosta/owm"
"log"
)
func main() {
// Create a new Client given an API key.
c := owm.NewClient("YOUR_OPEN_WEATHER_MAP_API_KEY")
// Decode the current forecast of a location given the city coordinates,
// days and units. ForecastByCoord returns a Forecast.
f, err := c.ForecastByCoord(38.72, -9.13, 16, "metric")
// If there is an error, print it and terminate the program.
if err != nil {
log.Fatal(err)
}
// Print a string representation of f using the Stringer interface.
fmt.Println(&f)
}
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.