CoinCapDev / CoinCap.io

API tools and documentation
730 stars 151 forks source link

/front returning html not json. #142

Open peterhendrick opened 5 years ago

peterhendrick commented 5 years ago

Not sure when this started, but the response.text property from the coincap.io/front URL I was using to load json into python is now returning html, and I can't find the json.

Do I need to use a new python library to load the html into python?

CoinCapDev commented 5 years ago

Hi Peter,

I’m hoping to get a better understanding of your issue. Could you please copy and paste in the request header, response header, and response body so we can properly diagnose the issue?

Laura ShapeShift

CoinCap Product Manager, ShapeShift AG laura@shapeshift.io mailto:laura@shapeshift.io | shapeshift.io http://shapeshift.io/ http://www.facebook.com/shapeshiftexchange/ http://twitter.com/ShapeShift_io http://www.youtube.com/channel/UCu3maYVeb18l2b1gqjO5KeQ http://www.reddit.com/r/shapeshiftio/ http://www.instagram.com/shapeshift_io/ https://shapeshift.io/gpg/.asc

On Oct 9, 2018, at 5:13 PM, peterhendrick notifications@github.com wrote:

Not sure when this started, but the response.text property from the coincap.io/front http://coincap.io/front URL I was using to load json into python is now returning html, and I can't find the json.

Do I need to use a new python library to load the html into python?

peterhendrick commented 5 years ago

Request header: {'Connection': 'keep-alive', 'User-Agent': 'python-requests/2.18.4', 'Accept': '/', 'Accept-Encoding': 'gzip, deflate'}

Response header: {'Expect-CT': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', 'Transfer-Encoding': 'chunked', 'CF-Cache-Status': 'HIT', 'Connection': 'keep-alive', 'Set-Cookie': '__cfduid=d15c9a589d6c9e365bd2336c8a339b4901539362531; expires=Sat, 12-Oct-19 16:42:11 GMT; path=/; domain=.coincap.io; HttpOnly', 'Content-Type': 'text/html; charset=utf-8', 'CF-RAY': '468b04aeb9d74fe7-DEN', 'Vary': 'Accept-Encoding', 'Content-Encoding': 'gzip', 'Date': 'Fri, 12 Oct 2018 16:42:11 GMT', 'Server': 'cloudflare', 'Cache-control': 'public, max-age=30', 'X-Powered-By': 'Next.js 6.1.2'}

The following is the response.text field that used to be in json and I was using json.loads(response.text) to bring into python. I guess I was just wondering if there is still a json representation of this, or if I need to switch libraries and load html into python.

response.text: <!DOCTYPE html>CoinCap.io | Reliable Cryptocurrency Prices and Market Capitalizations

<div id="next">
Market Cap
$201.73b
Exchange Vol
$10.63b
Assets
1,300
Exchanges
68
Markets
7,462
BTC Dom Index
54.1%
Rank Name Price Market Cap VWAP (24Hr) Supply Volume (24Hr) Change (24Hr) (24Hr) Trade
1$6,278.55$109.10b$6,280.8617.32m$3.21b0.33%
2$201.22$20.38b$196.46102.53m$1.09b-1.32%
3$0.41017362$17.10b$0.4142161840.00b$802.58m4.00%
4$449.42$7.80b$445.0917.40m$324.02m-0.27%
5$5.31$4.74b$5.22906.25m$444.41m-1.75%
6$0.21776932$4.13b$0.2154362018.89b$22.22m0.53%
7$52.71$3.15b$52.5658.69m$226.68m1.71%
8$0.99671937$2.69b$0.981441632.71b$2.25b-0.13%
9$0.07569053$1.96b$0.0734817725.93b$33.50m-0.23%
10$105.28$1.74b$104.2916.48m$263.75m-0.18%
11$0.02249132$1.53b$0.0221237965.75b$159.22m3.70%
12$0.51116001$1.41b$0.498138312.78b$22.89m-1.11%
13$162.21$1.34b$159.268.38m$177.08m-1.47%
14$9.57$1.13b$9.49117.44m$23.21m0.40%
15$16.03$1.04b$15.8765.00m$171.08m-0.42%
16$9.81$1.00b$9.65105.22m$214.87m-2.46%
17$0.09486162$834.34m$0.091897609.00b$5.71m-2.10%
18$1.29$757.06m$1.28607.49m$1.39m-3.64%
19$0.01186888$650.05m$0.0115606055.45b$7.97m-0.96%
20$0.00498375$613.58m$0.00516479116.53b$7.81m5.99%
Githubissues.
  • Githubissues is a development platform for aggregating issues.