Skip to content

HTTPError: 500 status code. (while downloading table from Regionalstatistikamt using pystatis) #189

Open
@aaashfaq

Description

@aaashfaq

Hello,

I want to download a table with code 3111-01-02.04 from the regionalstatistikamt website but i get the following above mentioned error. I am only able to download a few tables but not all of them. Most of the time I receive above error while downloading a table. Can you please

CODE:
import logging

from pystatis import Table
from pystatis import clear_cache

logging.basicConfig(level=logging.INFO)

t = Table("31111-01-02-4")
t.get_data()
t.data.head()

ERROR:

HTTPError Traceback (most recent call last)
Cell In[53], line 2
1 t = Table("31111-01-02-4")
----> 2 t.get_data()
3 t.data.head(2)

File c:\Users\ashfaq\AppData\Local\anaconda3\Lib\site-packages\pystatis\table.py:148, in Table.get_data(self, prettify, area, startyear, endyear, timeslices, regionalvariable, regionalkey, stand, language, quality)
145 db_matches = db.identify_db_matches(self.name)
146 db_name = db.select_db_by_credentials(db_matches)
--> 148 raw_data_bytes = load_data(
149 endpoint="data", method="tablefile", params=params, db_name=db_name
150 )
151 try:
152 raw_data_str = raw_data_bytes.decode("utf-8-sig")

File c:\Users\ashfaq\AppData\Local\anaconda3\Lib\site-packages\pystatis\http_helper.py:53, in load_data(endpoint, method, params, db_name)
51 logger.info("Data was loaded from cache.")
52 else:
---> 53 response = get_data_from_endpoint(endpoint, method, params, db_name)
54 content_type = response.headers.get("Content-Type", "text/csv").split("/")[
55 -1
56 ]
57 data = response.content
...
--> 275 raise requests.exceptions.HTTPError(
276 f"The server returned a {response.status_code} status code."
277 )

HTTPError: The server returned a 500 status code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions