LibraryOfCongress / api.congress.gov

congress.gov API
605 stars 38 forks source link

Error on `/bill/6/cen_doc_h/73/actions`: unknown resource. #169

Closed c4lliope closed 5 days ago

c4lliope commented 8 months ago

There is an uncommon bill in the 6th congress named 6 cen_doc_h 73. During a scraping run using: https://base.bingo/code/reap/src/branch/main/congress.process.rb

I came across a number of errors I need to manually bypass:

2023-10-28T17:39:26+00:00:      Pulling session/6/bill/cen_doc_h73.2023-07-06T17-55-26Z
                                .0; actions.0Error: Code # 404
"{\n    \"error\": \"Unknown resource: bill/6/cen_doc_h/73/actions\"\n}"
Error: Code # 404
"{\n    \"error\": \"Unknown resource: bill/6/cen_doc_h/73/actions\"\n}"
Error: Code # 404
"{\n    \"error\": \"Unknown resource: bill/6/cen_doc_h/73/actions\"\n}"
Error: Code # 404
"{\n    \"error\": \"Unknown resource: bill/6/cen_doc_h/73/actions\"\n}"
Error: Code # 404
"{\n    \"error\": \"Unknown resource: bill/6/cen_doc_h/73/actions\"\n}"
Error: Code # 404
"{\n    \"error\": \"Unknown resource: bill/6/cen_doc_h/73/actions\"\n}"
Error: Code # 404
"{\n    \"error\": \"Unknown resource: bill/6/cen_doc_h/73/actions\"\n}"
undefined method `code' for nil:NilClass

From: /root/reap/lib/congress.rb:84 Congress#query_address:

    79:     end
    80:
    81:     response
    82:   rescue => e
    83:     STDERR.puts e
 => 84:     binding.pry
    85:   end
    86:
    87:   def page_loop address, key, body
    88:     measures = []
    89:     begin

[1] pry(#<Congress>)>

I decided to bail from my retry loop and accept the error json, upon seeing any 404 errors... though this kicks the problem through to be handled in the application layer someday.

Gmanicus commented 8 months ago

Got curious and did some poking around. I remembered that, somewhat recently, the case sensitivity for some API endpoints was changed. It looks like it wants to return something when requesting bill/6/CEN_DOC_H/73, but hits an error

Reverse for 'bill_committees' with keyword arguments... not found...

bill/6/CEN_DOC_H/73/actions interestingly enough still returns "Unknown resource". Probably has something to do with the previous error.

rbram commented 7 months ago

Thank you for reporting this issue. Historical bills and bill text predate authenticated digital publishing. Additionally it is important to note that bills from 1799 (6th Congress) to 1817 (14th Congress) were not systematically numbered and appear as such on Congress.gov. That means that there is not an authoritative bill number associated with these bills and the number that appears in the URL is not a bill number. Read more about early congress bill numbering on our Numbers, Numbers, Numbers blog. We recognize that this is not ideal in the context of the API; however, this feedback inspires us to 1.) explore ways to improve the API’s retrieval of older Congressional data and 2.) improve our API Bill endpoint documentation.