USEPA / LCIAformatter

MIT License
24 stars 9 forks source link

403 Error accessing TRACI #94

Closed bl-young closed 12 months ago

bl-young commented 1 year ago

Accessing TRACI from the lciafmt is returning a 403 Forbidden error

INFO getting method Traci 2.1
INFO downloading from https://www.epa.gov/sites/default/files/2015-12/traci_2_1_2014_dec_10_0.xlsx to C:\Users\BYoung\AppData\Local\Temp\lciafmt\traci_2.1.xlsx
Traceback (most recent call last):

  File "c:\users\byoung\code\epa_dev\src\lciafmt\examples\traci.py", line 34, in <module>
    main()

  File "c:\users\byoung\code\epa_dev\src\lciafmt\examples\traci.py", line 12, in main
    data = lciafmt.get_method(method)

  File "C:\Users\BYoung\Code\epa_dev\src\lciafmt\lciafmt\__init__.py", line 114, in get_method
    return traci.get(add_factors_for_missing_contexts, file=file, url=None)

  File "C:\Users\BYoung\Code\epa_dev\src\lciafmt\lciafmt\traci.py", line 44, in get
    f = cache.get_or_download(fname, url)

  File "C:\Users\BYoung\Code\epa_dev\src\lciafmt\lciafmt\cache.py", line 67, in get_or_download
    download(url, file)

  File "C:\Users\BYoung\Code\epa_dev\src\lciafmt\lciafmt\cache.py", line 55, in download
    resp.raise_for_status()

  File "C:\Users\BYoung\Anaconda3\envs\epa_dev\lib\site-packages\requests\models.py", line 943, in raise_for_status
    raise HTTPError(http_error_msg, response=self)

HTTPError: 403 Client Error: Forbidden for url: https://www.epa.gov/sites/default/files/2015-12/traci_2_1_2014_dec_10_0.xlsx

I expect this is due to a change in configuration of the EPA website.

bl-young commented 1 year ago

@WesIngwersen are you aware of alternate locations for the TRACI excel file?

bl-young commented 12 months ago

resolved in https://github.com/USEPA/esupy/commit/b481e35262c9387c2e14ddcc8fa114dafe1c641d; update LCIAfmt to use esupy for requests in https://github.com/USEPA/LCIAformatter/commit/5ea4aee5515d01250e8c5029ca5d01d9f993e253