Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read_json from url, Accept Header? #10526

Closed
maxnoe opened this issue Jul 7, 2015 · 6 comments
Closed

read_json from url, Accept Header? #10526

maxnoe opened this issue Jul 7, 2015 · 6 comments
Labels
Enhancement IO JSON read_json, to_json, json_normalize IO Network Local or Cloud (AWS, GCS, etc.) IO Issues

Comments

@maxnoe
Copy link

maxnoe commented Jul 7, 2015

Today I tried to read json data from an url that checks the Accept-Header for 'application/json',
and only delivers json if this tag is higher ranked than 'text/html'.

See: Flask: Handling Accept Headers
It seems, that the pandas request in '_url_open' has no such header at all.

This works:

import requests
import pandas
url = "http://localhost:5000/foo"
r = requests.get(url, headers={'Accept': 'application/json'})
data = pandas.DataFrame(r.json())
print(data.head())

This does not, and I checked the header in the flask webapp of the received request, it is empty:

import pandas
url = "http://localhost:5000/foo"
data = pandas.read_json(url)
print(data.head())

It would make sense if the read_json had application/json in its Accept-Header, correct?

@fconil
Copy link

fconil commented Dec 1, 2015

Hi,

I have the same need for read_csv to use text/csv in Accept-Header when retrieving data from an URL.

Regards

@yuribak
Copy link

yuribak commented Feb 26, 2016

+1

@jbrockmendel jbrockmendel added the IO Data IO issues that don't fit into a more specific label label Jul 30, 2018
@ron819
Copy link

ron819 commented Aug 6, 2018

It's more than that. There should be full support for header , data and verity
For example:

hed = {'Authorization': 'Bearer ' + auth_token, 'Accept': 'application/json'}
data = {"client_id": "...", "client_secret": "...",
            "grant_type": "client_credentials", "scope": "PublicApi"}
response = requests.get(url, data=data, headers=hed, verify=True)

The read_json does not support this.

@albertonecosta
Copy link

@dmitrypol
Copy link

would be great if read_json supported passing headers. Super useful to reading data from APs w/o having to leverage requests

@jbrockmendel jbrockmendel added IO JSON read_json, to_json, json_normalize and removed IO Data IO issues that don't fit into a more specific label labels Dec 1, 2019
@mroeschke mroeschke added Enhancement IO Network Local or Cloud (AWS, GCS, etc.) IO Issues labels May 8, 2020
@jreback
Copy link
Contributor

jreback commented Oct 2, 2020

close in favor of #36688

@jreback jreback closed this as completed Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement IO JSON read_json, to_json, json_normalize IO Network Local or Cloud (AWS, GCS, etc.) IO Issues
Projects
None yet
Development

No branches or pull requests

9 participants