Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified docs/en/images/linux/tutorial-8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en/images/macOS/tutorial-8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en/images/windows/tutorial-8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/en/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ If you're not comfortable with English, translations of this tutorial are availa

/// admonition | This is a machine translation!

This version of the tutorial has been generated by machine translation. We know this isn't ideal, but we felt that a bad translation was better than no translation at all.
This document is a machine-generated translation of the [English](https://tutorial.beeware.org/) tutorial. We know that a machine translation isn't ideal, but we felt that a bad translation was better than no translation at all.

If you'd like the help improve the translation, get in touch! We have a `#translations` channel in [Discord](https://beeware.org/bee/chat/). Introduce yourself there and we will add you to the translation team.

Expand All @@ -30,7 +30,7 @@ If you'd like the help improve the translation, get in touch! We have a `#transl

/// admonition | This is a translation!

This document is a translation of the English version. The translation has been reviewed by humans, but newer sections may be generated by machine translation, or not translated at all.
This document is a translation of the [English](https://tutorial.beeware.org) tutorial. The translation has been reviewed by humans, but newer sections may have been generated by machine translation.

If you'd like the help improve the translation, get in touch! We have a `#translations` channel in [Discord](https://beeware.org/bee/chat/). Introduce yourself there and we will add you to the translation team.

Expand Down
3 changes: 3 additions & 0 deletions docs/en/tutorial/message.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"body": "Hello, API user!"
}
4 changes: 2 additions & 2 deletions docs/en/tutorial/tutorial-8.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ However, in a real world application, we'll need to perform complex tasks or cal

A common time-consuming task an app will need to perform is to make a request on a web API to retrieve data, and display that data to the user. Web APIs sometimes take a second or two to respond, so if we're calling an API like that, we need to ensure our application doesn't become unresponsive while we wait for the web API to return an answer.

This is a toy app, so we don't have a *real* API to work with, so we'll use the [{JSON} Placeholder API](https://jsonplaceholder.typicode.com) as a source of data. The {JSON} Placeholder API has a number of "fake" API endpoints you can use as test data. One of those APIs is the `/posts/` endpoint, which returns fake blog posts. If you open `https://jsonplaceholder.typicode.com/posts/42` in your browser, you'll get a JSON payload describing a single post - some [Lorum ipsum](https://en.wikipedia.org/wiki/Lorem_ipsum) content for a blog post with ID 42.
This is a toy app, so we don't have a *real* API to work with, so we'll use a sample API endpoint as a source of data. If you open [`https://tutorial.beeware.org/tutorial/message.json`](https://tutorial.beeware.org/tutorial/message.json) in your browser, you'll get a JSON payload with a message.

The Python standard library contains all the tools you'd need to access an API. However, the built-in APIs are very low level. They are good implementations of the HTTP protocol - but they require the user to manage lots of low-level details, like URL redirection, sessions, authentication, and payload encoding. As a "normal browser user" you're probably used to taking these details for granted, as a browser manages them for you.

Expand All @@ -35,7 +35,7 @@ Then modify the `say_hello()` callback so it looks like this:
async def say_hello(self, widget):
fake = faker.Faker()
with httpx.Client() as client:
response = client.get("https://jsonplaceholder.typicode.com/posts/42")
response = client.get("https://tutorial.beeware.org/tutorial/message.json")

payload = response.json()

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ commands:
translate : build_pot_translations
translate : build_po_translations de es fr it pt zh_CN zh_TW
translate : update_machine_translations --soft-fail de es fr it pt zh_CN zh_TW
lint : markdown-checker --dir {[docs]docs_dir} --func check_broken_urls
lint : pyspelling
lint : markdown-checker --dir {[docs]docs_dir} --func check_broken_urls
en : build_md_translations {posargs} en
de : build_md_translations {posargs} de
es : build_md_translations {posargs} es
Expand Down
Loading