diff --git a/CHANGELOG.md b/CHANGELOG.md index 4066505..635fd53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [v0.0.2](https://github.com/mr-pmillz/coinmon-go/tree/v0.0.2) (2021-10-26) + +[Full Changelog](https://github.com/mr-pmillz/coinmon-go/compare/v0.0.1...v0.0.2) + +## [v0.0.1](https://github.com/mr-pmillz/coinmon-go/tree/v0.0.1) (2021-10-26) + +[Full Changelog](https://github.com/mr-pmillz/coinmon-go/compare/v1.0.4...v0.0.1) + ## [v1.0.4](https://github.com/mr-pmillz/coinmon-go/tree/v1.0.4) (2021-10-16) [Full Changelog](https://github.com/mr-pmillz/coinmon-go/compare/v1.0.3...v1.0.4) diff --git a/README.md b/README.md index ed6684e..3078781 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ ![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/mr-pmillz/coinmon-go?style=plastic) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/mr-pmillz/coinmon-go?style=plastic) ![GitHub commit activity](https://img.shields.io/github/commit-activity/m/mr-pmillz/coinmon-go?style=plastic) +[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/12750b2a6fa44b429f8a3f64d3e7f1b6)](https://www.codacy.com/gh/mr-pmillz/coinmon-go/dashboard?utm_source=github.com&utm_medium=referral&utm_content=mr-pmillz/coinmon-go&utm_campaign=Badge_Coverage) Table of Contents ================= diff --git a/main.go b/main.go index b6be27a..6300b5a 100644 --- a/main.go +++ b/main.go @@ -54,6 +54,16 @@ func getJSON(url string, target interface{}) error { return err } defer r.Body.Close() + if r.StatusCode == 429 { + fmt.Printf("Sleeping for 15 seconds, too many requests HTTP Response: %d\n", r.StatusCode) + time.Sleep(time.Second * 15) + req, err := myClient.Get(url) + if err != nil { + return err + } + defer req.Body.Close() + return json.NewDecoder(req.Body).Decode(target) + } return json.NewDecoder(r.Body).Decode(target) }