hrecht / censusapi

R package to retrieve U.S. Census data and metadata via API
https://www.hrecht.com/censusapi/
169 stars 30 forks source link

Bug report: listCensusApis() URL changed? #89

Closed swiderskiji closed 10 months ago

swiderskiji commented 10 months ago

Describe the bug listCensusApis() returns error indicating the URL cannot be reached. However, getCensus() itself seems to work fine.

To Reproduce

> library("censusapi")

Attaching package: ‘censusapi’

The following object is masked from ‘package:methods’:

    getFunction

> listCensusApis()
Error in open.connection(con, "rb") : 
  cannot open the connection to 'https://api.census.gov/data.json'
In addition: Warning message:
In open.connection(con, "rb") :
  URL 'https://api.census.gov/data.json': status was 'Failure when receiving data from the peer'

(For what it's worth, that address doesn't seem to work directly entered in Firefox, either.

# using the example from the docs
> acs_simple <- getCensus(
+   name = "acs/acs5",
+   vintage = 2020,
+   vars = c("NAME", "B01001_001E", "B19013_001E"),
+   region = "place:*",
+   regionin = "state:01")
> head(acs_simple)
  state place                         NAME B01001_001E B19013_001E
1    01 44536    Lowndesboro town, Alabama          75       41667
2    01 44608         Loxley town, Alabama        2767       62292
3    01 44728        Luverne city, Alabama        2742       48468
4    01 44800           Lynn town, Alabama         832       36115
5    01 45040         McCalla CDP, Alabama       12077       71061
6    01 45208 McDonald Chapel CDP, Alabama         662       49038
> 

So, if I knew how to ask for what I want, it seems I could get it fine. But I don't seem to be able to use the method that's supposed to tell me how to ask...

R session information:

hrecht commented 10 months ago

Can you try again? This is working fine for me. The APIs can be buggy, it may have been down when you were last trying.

swiderskiji commented 10 months ago

Yes, does seem to be working for me now.