chrisallenlane / cdash

A minimalist cryptocurrency portfolio dashboard for the command-line that draws market data from the Coin Market Cap API.
MIT License
14 stars 3 forks source link

CoinMarketCap API has been deprecated #7

Open Fuzion24 opened 4 years ago

Fuzion24 commented 4 years ago
➜  Downloads ./cdash-darwin-amd64
Get https://api.coinmarketcap.com/v1/ticker/?convert=USD&limit=0: x509: certificate signed by unknown authority
Fuzion24 commented 4 years ago

This patch disables tls vadlidation and causes it to work again, but is obviously bad.

diff --git a/main.go b/main.go
index 021eb53..4d8f8e2 100644
--- a/main.go
+++ b/main.go
@@ -1,6 +1,7 @@
 package main

 import (
+       "crypto/tls"
        "encoding/json"
        "fmt"
        "log"
@@ -39,6 +40,7 @@ func main() {
        }, "")

        // query the coinmarketcap API
+       http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
        response, err := http.Get(url)
        if err != nil {
                log.Fatalln(err)
chrisallenlane commented 4 years ago

Oh, well this is pretty annoying. Pull it up in a browser: http://api.coinmarketcap.com/

WARNING: This API is now deprecated and will be taken offline soon. Please switch to the new CoinMarketCap API to avoid interruptions in service. (https://pro.coinmarketcap.com/migrate/)

I'll take a look at the new docs when I have the time. Hopefully it won't be a huge amount of work to reconfigure against the new API :/

Thanks for bringing this to my attention.

Fuzion24 commented 4 years ago

The old API officially died today :<