Mohit Narwani
Mohit Narwani

Reputation: 207

HTTP Error 403: Forbidden while reading csv file

I want to read live csv file with pandas but I am getting 404 error. I understood, it means server is rejecting unknown request

import pandas as pd
site= "https://demo-live-data.highcharts.com/time-data.csv"
df = pd.read_csv(site)

I also tried it with beautiful soup and request. By that I was getting another error

Upvotes: 0

Views: 1016

Answers (1)

Rohit R
Rohit R

Reputation: 26

import pandas as pd
import io
import requests

site = r"https://demo-live-data.highcharts.com/time-data.csv"
s = requests.get(site).content
df = pd.read_csv(io.StringIO(s.decode('utf-8'))) 
df.head()

Upvotes: 1

Related Questions