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

Error 500 when calling us_census() #37

Open
juancalvof opened this issue Apr 4, 2020 · 3 comments · May be fixed by #63
Open

Error 500 when calling us_census() #37

juancalvof opened this issue Apr 4, 2020 · 3 comments · May be fixed by #63
Labels
bug Something isn't working

Comments

@juancalvof
Copy link

juancalvof commented Apr 4, 2020

Description

I got the error 500 when calling us_census()

Error

data_us_census = ds.us_census.us_census()
Traceback (most recent call last):
File "C:\Users\juanc\Anaconda3\envs\coronawhy\lib\site-packages\IPython\core\interactiveshell.py", line 3331, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
data_us_census = ds.us_census.us_census()
File "c:\users\juanc\desktop\01 juan calvo\01 big data\01 proyectos\covid-19\code\repositories\task-geo\task_geo\data_sources\demographics\us_census\us_census.py", line 31, in us_census
df = us_census_connector()
File "c:\users\juanc\desktop\01 juan calvo\01 big data\01 proyectos\covid-19\code\repositories\task-geo\task_geo\data_sources\demographics\us_census\us_census.py", line 47, in us_census_connector
urllib.request.urlretrieve(url, "uscensus.zip")
File "C:\Users\juanc\Anaconda3\envs\coronawhy\lib\urllib\request.py", line 247, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
File "C:\Users\juanc\Anaconda3\envs\coronawhy\lib\urllib\request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\juanc\Anaconda3\envs\coronawhy\lib\urllib\request.py", line 531, in open
response = meth(req, response)
File "C:\Users\juanc\Anaconda3\envs\coronawhy\lib\urllib\request.py", line 641, in http_response
'http', request, response, code, msg, hdrs)
File "C:\Users\juanc\Anaconda3\envs\coronawhy\lib\urllib\request.py", line 569, in error
return self._call_chain(*args)
File "C:\Users\juanc\Anaconda3\envs\coronawhy\lib\urllib\request.py", line 503, in _call_chain
result = func(*args)
File "C:\Users\juanc\Anaconda3\envs\coronawhy\lib\urllib\request.py", line 649, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 500: Internal Server Error

@ManuelAlvarezC
Copy link
Collaborator

Hi @JuanCalvoFerrandiz, and thanks for reporting.

I have been able to replicate it and will start fixing it soon. I will keep you updated.

@ManuelAlvarezC ManuelAlvarezC added the bug Something isn't working label Apr 7, 2020
@DanielRobertNicoud
Copy link
Contributor

@cgomez9
Copy link

cgomez9 commented Apr 10, 2020

What is causing the problem is that the dataset URL was obtained getting the link address for the downloaded file in the web browser. This URL has the following form:

https://data.census.gov/api/access/table/download?download_id=TOKEN

The problem is that this TOKEN is changed in each download, making it useless when trying to download the file multiple times. We need to find a URL using the API directly.

@cgomez9 cgomez9 linked a pull request Apr 22, 2020 that will close this issue
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants