UBC-DSCI / introduction-to-datascience

Open Source Textbook for DSCI100: Introduction to Data Science in R
https://datasciencebook.ca/
Other
49 stars 53 forks source link

Twitter #487

Closed trevorcampbell closed 9 months ago

trevorcampbell commented 1 year ago

In the reading chapter, we use Twitter as an example of using an API to access data. The API used to be freely accessible, but I imagine it's a paid service now? Even if it isn't, we should probably consider changing that material to some other more openly-accessible API.

trevorcampbell commented 10 months ago

I suggest we switch to one of NASA's open APIs

https://api.nasa.gov/

they've got lots of great information about considerate API use / rate limiting etc

image

and one of their APIs is "astronomy picture of the day", which would be really neat to include :-)

image

the response you get is JSON, which I think is kind of unavoidable if we don't produce a package that wraps the API request.

{"date":"2023-09-12","explanation":"Some 4 billion light-years away, massive galaxy cluster Abell 370 is captured in this sharp Hubble Space Telescope snapshot. The cluster of galaxies only appears to be dominated by two giant elliptical galaxies and infested with faint arcs. In reality, the fainter, scattered bluish arcs, along with the dramatic dragon arc below and left of center, are images of galaxies that lie far beyond Abell 370. About twice as distant, their otherwise undetected light is magnified and distorted by the cluster's enormous gravitational mass, overwhelmingly dominated by unseen dark matter. Providing a tantalizing glimpse of galaxies in the early universe, the effect is known as gravitational lensing. A consequence of warped spacetime, lensing was predicted by Einstein almost a century ago. Far beyond the spiky foreground Milky Way star at lower right, Abell 370 is seen toward the constellation Cetus, the Sea Monster. It was the last of six galaxy clusters imaged in the Frontier Fields project.","hdurl":"https://apod.nasa.gov/apod/image/2309/STSCI-HST-abell370_1797x2000.jpg","media_type":"image","service_version":"v1","title":"Galaxy Cluster Abell 370 and Beyond","url":"https://apod.nasa.gov/apod/image/2309/STSCI-HST-abell370_1024.jpg"}
trevorcampbell commented 10 months ago

@joelostblom thoughts? We definitely need to do something like this before python goes to print. I suspect NASA should be very stable

another one that is probably more boring but more Canadian is the Govt of Canada APIs https://api.canada.ca/en/homepage

.... wait, nevermind.

image

joelostblom commented 10 months ago

I'm in favor of switching from twitter's API to NASA :+1: