You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/reading.md
+15-14Lines changed: 15 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -961,7 +961,7 @@ something known as an **a**pplication **p**rogramming **i**nterface (API),
961
961
which provides a programmatic way to ask for subsets of a data set. This allows
962
962
the website owner to control *who* has access to the data, *what portion* of
963
963
the data they have access to, and *how much* data they can access. Typically,
964
-
the website owner will give you a *token*(or *key*, a secret string of characters
964
+
the website owner will give you a *token* or *key* (a secret string of characters
965
965
somewhat like a password) that you have to provide when accessing the API.
966
966
967
967
```{index} web scraping, CSS, HTML
@@ -1069,7 +1069,7 @@ above you can see a line that looks like
1069
1069
<spanclass="result-price">$800</span>
1070
1070
```
1071
1071
1072
-
That is definitely storing the price of a particular apartment. With some more
1072
+
That snippet is definitely storing the price of a particular apartment. With some more
1073
1073
investigation, you should be able to find things like the date and time of the
1074
1074
listing, the address of the listing, and more. So this source code most likely
1075
1075
contains all the information we are interested in!
@@ -1152,7 +1152,7 @@ The selector gadget returns them to us as a comma-separated list (here
1152
1152
`.housing , .result-price`), which is exactly the format we need to provide to
1153
1153
Python if we are using more than one CSS selector.
1154
1154
1155
-
**Stop! Are you allowed to scrape that website?**
1155
+
**Caution: are you allowed to scrape that website?**
1156
1156
1157
1157
```{index} web scraping; permission
1158
1158
```
@@ -1336,7 +1336,7 @@ format for data analysis.
1336
1336
1337
1337
Rather than posting a data file at a URL for you to download, many websites
1338
1338
these days provide an API that can be accessed through a programming language
1339
-
like Python. The benefit of this is that data owners have much more control
1339
+
like Python. The benefit of using an API is that data owners have much more control
1340
1340
over the data they provide to users. However, unlike web scraping, there is no
1341
1341
consistent way to access an API across websites. Every website typically has
1342
1342
its own API designed especially for its own use case. Therefore we will just
@@ -1359,7 +1359,7 @@ The James Webb Space Telescope's NIRCam image of the Rho Ophiuchi molecular clou
1359
1359
1360
1360
+++
1361
1361
1362
-
First, you will need to visit the [NASA APIs page](https://api.nasa.gov/) and generate an API key.
1362
+
First, you will need to visit the [NASA APIs page](https://api.nasa.gov/) and generate an API key (i.e., a password used to identify you when accessing the API).
1363
1363
Note that a valid email address is required to
1364
1364
associate with the key. The signup form looks something like {numref}`fig:NASA-API-signup`.
1365
1365
After filling out the basic information, you will receive the token via email.
@@ -1372,7 +1372,7 @@ Make sure to store the key in a safe place, and keep it private.
1372
1372
Generating the API access token for the NASA API.
1373
1373
```
1374
1374
1375
-
**Stop! Think about your API usage carefully!**
1375
+
**Caution: think about your API usage carefully!**
1376
1376
1377
1377
When you access an API, you are initiating a transfer of data from a web server
1378
1378
to your computer. Web servers are expensive to run and do not have infinite resources.
@@ -1407,8 +1407,7 @@ API, we need to specify three things. First, we specify the URL *endpoint* of
1407
1407
the API, which is simply a URL that helps the remote server understand which
1408
1408
API you are trying to access. NASA offers a variety of APIs, each with its own
1409
1409
endpoint; in the case of the NASA "Astronomy Picture of the Day" API, the URL
1410
-
endpoint is `https://api.nasa.gov/planetary/apod`, as shown at the top of
1411
-
{numref}`fig:NASA-API-parameters`. Second, we write `?`, which denotes that a
1410
+
endpoint is `https://api.nasa.gov/planetary/apod`. Second, we write `?`, which denotes that a
1412
1411
list of *query parameters* will follow. And finally, we specify a list of
1413
1412
query parameters of the form `parameter=value`, separated by `&` characters. The NASA
1414
1413
"Astronomy Picture of the Day" API accepts the parameters shown in
@@ -1423,7 +1422,8 @@ along with syntax, default settings, and a description of each.
1423
1422
1424
1423
So for example, to obtain the image of the day
1425
1424
from July 13, 2023, the API query would have two parameters: `api_key=YOUR_API_KEY`
1426
-
and `date=2023-07-13`.
1425
+
and `date=2023-07-13`. Remember to replace `YOUR_API_KEY` with the API key you
1426
+
received from NASA in your email! Putting it all together, the query will look like the following:
0 commit comments