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: docs/docs/03_first_rest_api/05_make_request_to_rest_api/README.md
+7-7
Original file line number
Diff line number
Diff line change
@@ -29,11 +29,11 @@ Start by [downloading Insomnia REST Client](https://insomnia.rest/).
29
29
30
30
Once you've opened it, create a Project. I would call it "REST APIs with Flask and Python".
31
31
32
-

32
+

33
33
34
34
Then, create a new Request Collection. Call it "Stores REST API".
35
35
36
-

36
+

37
37
38
38
In the Request Collection, we can now add requests! Each request has a few parts:
Make a new request using the Insomnia interface. First, use the dropdown to start:
48
48
49
-

49
+

50
50
51
51
Then enter the request name. Leave the method as `GET`:
52
52
53
-

53
+

54
54
55
55
Once you're done, you will see your request in the collection:
56
56
57
-

57
+

58
58
59
59
Next up, enter the URL for your request. Here we will be requesting the `/store` endpoint. Remember to include your Base URL as well:
60
60
61
-

61
+

62
62
63
63
Once you're done, make sure that your Flask app is running! If it isn't, remember to activate your virtual environment first and then run the app:
64
64
@@ -75,6 +75,6 @@ If you get an error, read it carefully and make sure that no other Flask app is
75
75
76
76
Once your Flask app is running, you can hit "Send" on the Insomnia client, and you should see the JSON come back from your API!
77
77
78
-

78
+

79
79
80
80
If that worked and you can see your JSON, you're good to go! You've made your first API request. Now we can continue developing our REST API, remembering to always create new Requests in Insomnia and test our code as we go along!
Looks similar, but the `docker -> container` section is much more efficient than running a VM because it **uses the host's kernel** instead of running its own.
Copy file name to clipboardExpand all lines: docs/docs/04_docker_intro/03_run_docker_container/README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -126,6 +126,6 @@ docker run -dp 5001:5000 rest-apis-flask-python
126
126
127
127
Try making requests using the URL `127.0.0.1:5000` with Insomnia REST Client or Postman, and you should see it working well!
128
128
129
-

129
+

Copy file name to clipboardExpand all lines: docs/docs/05_flask_smorest/05_reload_api_docker_container/README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -102,4 +102,4 @@ Using this kind of volume mapping only makes sense _during development_. When yo
102
102
103
103
Just to recap, here are the two ways we've seen to run your Docker container:
104
104
105
-

105
+

Copy file name to clipboardExpand all lines: docs/docs/07_sqlalchemy_many_to_many/01_section_changes/README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ This means that tags will have:
31
31
32
32
Here's a diagram to illustrate what this looks like:
33
33
34
-

34
+

Copy file name to clipboardExpand all lines: docs/docs/08_flask_jwt_extended/03_how_is_jwt_used/README.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ Here is a diagram of the interaction between client and API to generate an acces
18
18
19
19
<divstyle={{maxWidth:'600px'}}>
20
20
21
-

21
+

22
22
23
23
</div>
24
24
@@ -56,7 +56,7 @@ Here is a rather long diagram depicting what happens:
56
56
57
57
<divstyle={{maxWidth:'600px'}}>
58
58
59
-

59
+

Copy file name to clipboardExpand all lines: docs/docs/08_flask_jwt_extended/11_insomnia_request_chaining/README.md
+9-9
Original file line number
Diff line number
Diff line change
@@ -12,40 +12,40 @@ Up until now, we've been able to log in, get an access token, and then use that
12
12
13
13
Instead of passing the JWT in every request, you can access the `Headers` section and follow these steps. In the `Authorization` field, type `Bearer` add a space and then press `CTRL + SPACE` to get a contextual menu. Navigate to the `Response -> Body Attribute` field and select it, as shown in the screenshot below:
14
14
15
-

15
+

16
16
17
17
After you've selected it, you'll see an error that looks like this:
18
18
19
-

19
+

20
20
21
21
If you click on the error, you'll see a modal window:
22
22
23
-

23
+

24
24
25
25
Inside of this window, you will first need to select a request that you want to get the data from. Click on `Select item` inside the `Request` field and choose the `POST /login` endpoint. After you've done that, go to the `Filter` field. In this field, we are telling Insomnia which part of the response we want to get from it. The prompt is started with the dollar sign `$` and then we can use the dot to access the attributes of the response. If we only type `$` or `$.`, we'll get a list of all the attributes of the response:
26
26
27
-

27
+

28
28
29
29
In our case, we want to get the `access_token` attribute from the response, so we type `$.access_token`. If there was something else inside the `access_token` that you wanted to access like some value for example, you could do `$.access_token.value` and so on. After you've added the filter, you can set the `Trigger Behavior`. For example, you can set it to `When expired` and set time to 300 seconds. This means that the token will be refreshed every 5 minutes. The filled out window should look like this:
30
30
31
-

31
+

32
32
33
33
You can now press `Done` and you'll see that the error is gone and that the `Authorization` field is filled out with the `Bearer` token:
34
34
35
-

35
+

36
36
37
37
Since we use multiple protected endpoints, we would need to use the same method to get the `access_token` for every request. To tackle this problem, we can use [environment variables](https://support.insomnia.rest/article/13-environment-variables), as we did before for the `url` variable.
38
38
39
39
To do this, you need to create a new environment variable. Click on the `No Environment` button in the top left corner of the Insomnia window and then click on the `Manage Environments` button, you will see a base environment that looks like this:
40
40
41
-

41
+

42
42
43
43
Add a new environment variable called `access_token`, and for its value you should follow the same process from above. As a quick reminder, you should press `CTRL + SPACE` to get the contextual menu and then select the `Response -> Body Attribute` field. Click on the error that will show up and fill out the modal window as we've done before. Make sure to wrap the `Response -> Body Attribute` with quotation marks, as shown in the screenshot. When the variable is created, your environment should look like this:
44
44
45
-

45
+

46
46
47
47
You will now be able to use this environment variable in all of the endpoints by simply writing `{{access_token}}` in the field that you want to use it in. Coming back to the first example, you can use the access token in the `Authorization` field by writing `Bearer {{access_token}}` and this will be the result:
48
48
49
-

49
+

50
50
51
51
If you try and make the request, you will see that it works just like before, without needing to copy and paste the access token.
Copy file name to clipboardExpand all lines: docs/docs/11_deploy_to_render/02_create_render_web_service/README.md
+6-6
Original file line number
Diff line number
Diff line change
@@ -16,11 +16,11 @@ Then you'll [connect your GitHub account](https://render.com/docs/github) if you
16
16
17
17
Select the repository that you created during this course:
18
18
19
-

19
+

20
20
21
21
Then, give it a name and make sure the configuration is as follows:
22
22
23
-

23
+

24
24
25
25
- Make sure "Docker" is selected.
26
26
- Select a server location close to you. I'm near Frankfurt, but if you are in the US or Asia you might want to choose a different one so it's faster to connect to.
@@ -32,19 +32,19 @@ For now, hit "Create Web Service" and wait for it to deploy your code from GitHu
32
32
33
33
If you navigate to your Dashboard and then click through to your newly created service, you'll be able to see the service details. If it isn't already deploying, click on the "Manual Deploy" button on the top right to initiate a deploy of the latest commit:
While on the free plan, deployments are a bit slow. It has to build your image and run it! Give it a few minutes, until the deployment succeeds. You should see this:
Free services in Render.com shut down after inactivity for a few minutes. If you don't use your service for a few minutes, it will shut down and it will need to restart, which can take a minute! This is one of the limitations of their free plan.
Copy file name to clipboardExpand all lines: docs/docs/11_deploy_to_render/04_deploy_postgresql_database/README.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -12,10 +12,10 @@ That's why I recommend using ElephantSQL for your free PostgreSQL needs. When yo
12
12
13
13
To get a free ElephantSQL PostgreSQL database, just go to their site, sign up, and then create a database in a region close to your Render.com server. Make sure to select the free tier.
14
14
15
-

15
+

16
16
17
17
Once you've got this, you should be able to see the Database URL:
18
18
19
-

19
+

Copy file name to clipboardExpand all lines: docs/docs/11_deploy_to_render/05_environment_variables_and_migrations/README.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -360,11 +360,11 @@ Now that our Flask app is using environment variables, all we have to do is add
360
360
361
361
To add environment variables in Render.com, go to the service settings and then on the left you'll see "Environment":
362
362
363
-

363
+

364
364
365
365
Click on "Add Environment Variable", and there put `DATABASE_URL` as the key, and your ElephantSQL Database URL as the value:
366
366
367
-

367
+

Copy file name to clipboardExpand all lines: docs/docs/12_task_queues_emails/01_send_emails_python_mailgun/README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@ You will get an email to confirm. Click the button that you see in that email to
38
38
39
39
Next up, grab your API key. You can find it by clicking on this button (my domain and API key are blurred in this screenshot):
40
40
41
-

41
+

Copy file name to clipboardExpand all lines: docs/docs/12_task_queues_emails/03_what_is_task_queue/README.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ ctslug: what-is-a-task-queue
6
6
7
7
A queue is a data structure to which you can add and remove data, but a key aspect of it is that when you want to remove a piece of data from it, the piece of data removed is the first piece of data that was added.
8
8
9
-

9
+

10
10
11
11
This is identical to how people queuing works. The first person to arrive at the queue (i.e. the first in line), is the first person removed from the queue when they reach the ticket counter.
12
12
@@ -32,6 +32,6 @@ Later on if we want, we can upgrade to one of the paid plans.
32
32
33
33
To be able to add tasks to the queue from your dev environment, make sure to [allow external connections](https://render.com/docs/redis#connecting-to-your-redis-from-outside-render) in your Redis database configuration.
34
34
35
-

35
+

36
36
37
37
You should get a Redis URL that looks like this: `rediss://red-ct8aen0hkl10:[email protected]:6379`. Save it, for we'll need it in the next lecture!
Copy file name to clipboardExpand all lines: docs/docs/12_task_queues_emails/06_sending_html_emails/README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -255,7 +255,7 @@ Now remember to restart your app _and_ your background worker, then try to regis
255
255
256
256
You should get the HTML email delivered!
257
257
258
-

258
+

259
259
260
260
:::info Spam or junk?
261
261
If your emails are going to spam, it's likely because you're using the sandbox domain. When you use an actual domain, you have to go through various [domain verification steps](https://help.mailgun.com/hc/en-us/articles/360011702394-Why-Do-My-Emails-Go-to-Spam-) which reduce the likelihood of your emails ending up in spam.
0 commit comments