Skip to content

Commit e46f381

Browse files
authored
Fix JSON API usage, and link to main EN translation. (#65)
1 parent 26d7401 commit e46f381

7 files changed

Lines changed: 8 additions & 5 deletions

File tree

26.7 KB
Loading
-989 Bytes
Loading
53.6 KB
Loading

docs/en/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ If you're not comfortable with English, translations of this tutorial are availa
1818

1919
/// admonition | This is a machine translation!
2020

21-
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.
21+
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.
2222

2323
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.
2424

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

3131
/// admonition | This is a translation!
3232

33-
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.
33+
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.
3434

3535
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.
3636

docs/en/tutorial/message.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"body": "Hello, API user!"
3+
}

docs/en/tutorial/tutorial-8.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ However, in a real world application, we'll need to perform complex tasks or cal
88

99
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.
1010

11-
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.
11+
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.
1212

1313
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.
1414

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

4040
payload = response.json()
4141

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ commands:
1616
translate : build_pot_translations
1717
translate : build_po_translations de es fr it pt zh_CN zh_TW
1818
translate : update_machine_translations --soft-fail de es fr it pt zh_CN zh_TW
19-
lint : markdown-checker --dir {[docs]docs_dir} --func check_broken_urls
2019
lint : pyspelling
20+
lint : markdown-checker --dir {[docs]docs_dir} --func check_broken_urls
2121
en : build_md_translations {posargs} en
2222
de : build_md_translations {posargs} de
2323
es : build_md_translations {posargs} es

0 commit comments

Comments
 (0)