{"id":20263135,"url":"https://github.com/briandowns/openweathermap","last_synced_at":"2025-05-15T13:04:51.915Z","repository":{"id":21808393,"uuid":"25131041","full_name":"briandowns/openweathermap","owner":"briandowns","description":"Go (golang) package for use with openweathermap.org's API.","archived":false,"fork":false,"pushed_at":"2024-12-20T15:39:56.000Z","size":818,"stargazers_count":247,"open_issues_count":14,"forks_count":74,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-07T16:13:14.640Z","etag":null,"topics":["go","golang","openweathermap-api","weather"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/briandowns.png","metadata":{"files":{"readme":"README.md","changelog":"history.go","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-10-12T20:23:47.000Z","updated_at":"2025-04-07T14:01:30.000Z","dependencies_parsed_at":"2025-01-04T03:03:55.183Z","dependency_job_id":null,"html_url":"https://github.com/briandowns/openweathermap","commit_stats":{"total_commits":297,"total_committers":30,"mean_commits":9.9,"dds":"0.17508417508417506","last_synced_commit":"8e31b50d95e44f545af3832b16fd0b713058dc50"},"previous_names":["briandowns/go-openweathermap"],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briandowns%2Fopenweathermap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briandowns%2Fopenweathermap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briandowns%2Fopenweathermap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briandowns%2Fopenweathermap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/briandowns","download_url":"https://codeload.github.com/briandowns/openweathermap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248961190,"owners_count":21189991,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","openweathermap-api","weather"],"created_at":"2024-11-14T11:33:39.985Z","updated_at":"2025-04-14T20:57:55.485Z","avatar_url":"https://github.com/briandowns.png","language":"Go","funding_links":[],"categories":["Applications"],"sub_categories":[],"readme":"# OpenWeatherMap Go API\n\n[![GoDoc](https://godoc.org/github.com/briandowns/openweathermap?status.svg)](https://godoc.org/github.com/briandowns/openweathermap) [![Build Status](https://travis-ci.org/briandowns/openweathermap.svg?branch=master)](https://travis-ci.org/briandowns/openweathermap) [![Coverage Status](https://coveralls.io/repos/github/briandowns/openweathermap/badge.svg?branch=master)](https://coveralls.io/github/briandowns/openweathermap?branch=master)\n\nGo (golang) package for use with openweathermap.org's API.\n\nFor more detail about the library and its features, reference your local godoc once installed.\n\n[Website](https://briandowns.github.io/openweathermap)!\n\nTo use the OpenweatherMap API, you need to obtain an API key.  Sign up [here](http://home.openweathermap.org/users/sign_up).  Once you have your key, create an environment variable called `OWM_API_KEY`.  Start coding!\n\n[Slack Channel](https://openweathermapgolang.slack.com/messages/general)\n\nContributions welcome!\n\n## Features\n\n### Current Weather Conditions\n\n- By City\n- By City,St (State)\n- By City,Co (Country)\n- By City ID\n- By Zip,Co (Country)\n- By Longitude and Latitude\n\n## Forecast\n\nGet the weather conditions for a given number of days.\n\n- By City\n- By City,St (State)\n- By City,Co (Country)\n- By City ID\n- By Longitude and Latitude\n\n### Access to Condition Codes and Icons\n\nGain access to OpenWeatherMap icons and condition codes.\n\n- Thunderstorms\n- Drizzle\n- Rain\n- Snow\n- Atmosphere\n- Clouds\n- Extreme\n- Additional\n\n### Data Available in Multiple Measurement Systems\n\n- Fahrenheit (OpenWeatherMap API - imperial)\n- Celsius (OpenWeatherMap API - metric)\n- Kelvin (OpenWeatherMap API - internal)\n\n### UV Index Data\n\n- Current\n- Historical\n\n### Pollution Data\n\n- Current\n\n## Historical Conditions\n\n- By Name\n- By ID\n- By Coordinates\n\n## Supported Languages\n\nEnglish - en, Russian - ru, Italian - it, Spanish - es (or sp), Ukrainian - uk (or ua), German - de, Portuguese - pt, Romanian - ro, Polish - pl, Finnish - fi, Dutch - nl, French - fr, Bulgarian - bg, Swedish - sv (or se), Chinese Traditional - zh_tw, Chinese Simplified - zh (or zh_cn), Turkish - tr, Croatian - hr, Catalan - ca\n\n## Installation\n\n```bash\ngo get github.com/briandowns/openweathermap\n```\n\n## Examples\n\nThere are a few full examples in the examples directory that can be referenced.  1 is a command line application and 1 is a simple web application.\n\n```Go\npackage main\n\nimport (\n\t\"log\"\n\t\"fmt\"\n\t\"os\"\n\n\t// Shortening the import reference name seems to make it a bit easier\n\towm \"github.com/briandowns/openweathermap\"\n)\n\nvar apiKey = os.Getenv(\"OWM_API_KEY\")\n\nfunc main() {\n\tw, err := owm.NewCurrent(\"F\", \"ru\", apiKey) // fahrenheit (imperial) with Russian output\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tw.CurrentByName(\"Phoenix\")\n\tfmt.Println(w)\n}\n\n```\n\n### Current Conditions by location name\n\n```Go\nfunc main() {\n    w, err := owm.NewCurrent(\"K\", \"EN\", apiKey) // (internal - OpenWeatherMap reference for kelvin) with English output\n    if err != nil {\n        log.Fatalln(err)\n    }\n\n    w.CurrentByName(\"Phoenix,AZ\")\n    fmt.Println(w)\n}\n```\n\n### Forecast Conditions in imperial (fahrenheit) by coordinates\n\n```Go\nfunc main() {\n    w, err := owm.NewForecast(\"5\", \"F\", \"FI\", apiKey) // valid options for first parameter are \"5\" and \"16\"\n    if err != nil {\n        log.Fatalln(err)\n    }\n\n    w.DailyByCoordinates(\n        \u0026owm.Coordinates{\n                Longitude: -112.07,\n                Latitude: 33.45,\n        },\n        5 // five days forecast\n    )\n    fmt.Println(w)\n}\n```\n\n### Current conditions in metric (celsius) by location ID\n\n```Go\nfunc main() {\n    w, err := owm.NewCurrent(\"C\", \"PL\", apiKey)\n    if err != nil {\n        log.Fatalln(err)\n    }\n\n    w.CurrentByID(2172797)\n    fmt.Println(w)\n}\n```\n\n### Current conditions by zip code. 2 character country code required\n\n```Go\nfunc main() {\n    w, err := owm.NewCurrent(\"F\", \"EN\", apiKey)\n    if err != nil {\n        log.Fatalln(err)\n    }\n\n    w.CurrentByZip(19125, \"US\")\n    fmt.Println(w)\n}\n```\n\n### Configure http client\n\n```Go\nfunc main() {\n    client := \u0026http.Client{}\n    w, err := owm.NewCurrent(\"F\", \"EN\", apiKey, owm.WithHttpClient(client))\n    if err != nil {\n        log.Fatalln(err)\n    }\n}\n```\n\n### Current UV conditions\n\n```Go\nfunc main() {\n    uv, err := owm.NewUV(apiKey)\n    if err != nil {\n        log.Fatalln(err)\n    }\n\n    coord := \u0026owm.Coordinates{\n        Longitude: 53.343497,\n        Latitude:  -6.288379,\n    }\n\n    if err := uv.Current(coord); err != nil {\n        log.Fatalln(err)\n    }\n    \n    fmt.Println(coord)\n}\n```\n\n### Historical UV conditions\n\n```Go\nfunc main() {\n    uv, err := owm.NewUV(apiKey)\n    if err != nil {\n        log.Fatalln(err)\n    }\n\n    coord := \u0026owm.Coordinates{\n        Longitude: 54.995656,\n        Latitude:  -7.326834,\n    }\n\n    end := time.Now().UTC()\n    start := time.Now().UTC().Add(-time.Hour * time.Duration(24))\n\n    if err := uv.Historical(coord, start, end); err != nil {\n        log.Fatalln(err)\n    }\n}\n```\n\n### UV Information\n\n```Go\nfunc main() {\n    uv, err := owm.NewUV(apiKey)\n    if err != nil {\n        log.Fatalln(err)\n    }\n    \n    coord := \u0026owm.Coordinates{\n    \tLongitude: 53.343497,\n    \tLatitude:  -6.288379,\n    }\n    \n    if err := uv.Current(coord); err != nil {\n    \tlog.Fatalln(err)\n    }\n\n    info, err := uv.UVInformation()\n    if err != nil {\n        log.Fatalln(err)\n    }\n    \n    fmt.Println(info)\n}\n```\n\n### Pollution Information\n\n```Go\nfunc main() {\n    pollution, err := owm.NewPollution(apiKey)\n    if err != nil {\n        log.Fatalln(err)\n    }\n\n    params := \u0026owm.PollutionParameters{\n        Location: owm.Coordinates{\n            Latitude:  0.0,\n            Longitude: 10.0,\n        },\n        Datetime: \"current\",\n    }\n\n    if err := pollution.PollutionByParams(params); err != nil {\n        log.Fatalln(err)\n    }\n}\n```\n\n### One Call Information\n\n```Go\nfunc main() {\n\t// Possibility to exclude information. For example exclude daily information []string{ExcludeDaily}\n\tw, err := owm.NewOneCall(\"F\", \"EN\", apiKey, []string{})\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\terr = w.OneCallByCoordinates(\n\t\t\u0026Coordinates{\n\t\t\tLongitude: -112.07,\n\t\t\tLatitude:  33.45,\n\t\t},\n\t)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tfmt.Println(w)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriandowns%2Fopenweathermap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbriandowns%2Fopenweathermap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriandowns%2Fopenweathermap/lists"}