download_fr.valid_request#

download_fr.valid_request(response, file_format='geojson', prev_frame=None)[source]#

Utilitary to check if a request is valid.

Parameters#

responserequest.response

request object that contains a server’s response to an HTTP request. This response variable can be obtained with requests.get(<url>)

file_format{‘csv’, ‘json’, ‘geojson’}, default ‘geojson’

File format in which the data will be retrieved.

prev_framepandas.DataFrame or geopandas.GeoDataFrame, optional

Frame used for recurrence run (when request results are on several pages)

Returns#

isvalidbool

Flag indicating if the request has succeeded.

framepandas.DataFrame of geopandas.GeoDataFrame

Frame contaning the downloaded values. If file_format is ‘geojson’, returns a geopandas.GeoDataFrame, otherwise return a pandas.DataFrame (non-geospatialized data).