Skip to content

Commit

Permalink
Add questions/objectives/keypoints + first challenge
Browse files Browse the repository at this point in the history
  • Loading branch information
jdangerx committed Oct 24, 2024
1 parent 99eaf20 commit 4eee66f
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 3 deletions.
6 changes: 3 additions & 3 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ contact: '[email protected]'
#
# Example -------------
#
# episodes:
# - introduction.md
# - first-steps.md
episodes:
- introduction.md
- downloading-files-programmatically.md
#
# learners:
# - setup.md
Expand Down
45 changes: 45 additions & 0 deletions episodes/downloading-files-programmatically.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: Downloading files programmatically
teaching: 0
exercises: 0
---

:::::::: questions

* How can I get data when there isn't a 'download' link?
* How can I work with data that is behind an API with access restrictions?

::::::::

:::::::: objectives

* request data from a REST API using `requests`
* authenticate to a REST API using HTTP basic auth, bearer tokens, etc.
* explore directories in AWS cloud buckets
* download data from AWS using pandas

::::::::

:::::::: challenge

Make a `GET` request to `https://www.catalyst.coop` using `requests`!

:::: solution

```python
import requests

requests.get("https://www.catalyst.coop")
```

::::

::::::::

:::::::: keypoints

* `pandas.read_*` can read tabular data from remote servers & cloud storage as if it was on your local computer
* `requests` can get data from APIs, though you'll have to do the translation from their response format into `pandas.DataFrame` yourself
* To get access to access-restricted APIs, you will usually pass in an API key, as a request *header* or as a request *parameter*. Both `requests` and `pandas.read_*` have the ability to do this.

::::::::

0 comments on commit 4eee66f

Please sign in to comment.