-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🌐 Add Korean translation for docs/ko/docs/tutorial/request-forms.md
#2908
Changes from 4 commits
0935482
9e6c4eb
6150d0b
ef5d217
ea788cc
71a89ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,60 @@ | ||||||
# 폼 데이터 | ||||||
|
||||||
JSON 대신에 폼 데이터 필드를 받을 필요가 있을 때, `폼`을 사용할 수 있습니다. | ||||||
|
||||||
!!! info "정보" | ||||||
폼을 사용하기 위해서는 일단 <a href="https://andrew-d.github.io/python-multipart/" class="external-link" target="_blank">`python-multipart`</a>를 설치해야 합니다. | ||||||
|
||||||
E.g. `pip install python-multipart`. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Check #2017 . I think it is more convenient for beginners to elaborate the meaning of |
||||||
|
||||||
## `폼` 임포트 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
`fastapi`에서 `Form`을 임포트합니다: | ||||||
|
||||||
```Python hl_lines="1" | ||||||
{!../../../docs_src/request_forms/tutorial001.py!} | ||||||
``` | ||||||
|
||||||
## `폼` 매개변수 정의하기 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I prefer |
||||||
|
||||||
`본문`이나 `쿼리`와 같은 방법으로 폼 매개변수도 생성합니다: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
|
||||||
```Python hl_lines="7" | ||||||
{!../../../docs_src/request_forms/tutorial001.py!} | ||||||
``` | ||||||
|
||||||
예를 들어, Oauth2 사양을 사용할 수 있는 ("비밀번호 흐름"이라고 불리는) 방법은 `username` 과 `password`를 폼데이터로 보내는 것이 필수입니다. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
|
||||||
이 <abbr title="specification">사양</abbr>은 정확히 `username` 과 `password`라고 된 필드들이 필요하고 JSON이 아닌 폼 필드로 보내야 합니다. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Although the word |
||||||
|
||||||
`폼`만 있으면 `본문`(`쿼리`, `경로`, `쿠키`)와 마찬가지로 같은 메타데이터와 유효성 검사를 선언할 수 있습니다. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Here, the |
||||||
|
||||||
!!! info "정보" | ||||||
`폼`은 `본문`을 직접적으로 상속받은 클래스입니다. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
!!! tip "팁" | ||||||
`Form` 없이는 매개변수가 쿼리 매개변수나 본문(JSON) 매개변수로 해석 되기 때문에 폼 본문을 선언하기 위해서는 `Form`을 명시적으로 상용하는 것이 필요합니다. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
|
||||||
## "폼 필드"에 대해 | ||||||
|
||||||
HTML 폼(`<form></form>`)이 서버로 데이터를 보내는 방법은 일반적으로 그 데이터를 위해 JSON과는 다른 "특별한" 인코딩 방법을 사용합니다. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
**FastAPI** JSON 대신에 정확한 곳에서 그 데이터를 읽을 수 있어야 합니다. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
!!! note "기술적인 세부사항" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Check 파이썬 공식 한국어 문서에 없는 용어 중 현재 사용하고 있는 용어 in #3167 . |
||||||
폼으로부터 받은 데이터는 일반적으로 "media type" `application/x-www-form-urlencoded`을 이용해서 암호화 됩니다. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
폼이 파일을 포함하고 있을 때는 `multipart/form-data`로 암호화 됩니다. 다음 챕터에서 파일 다루기에 대해 읽을 수 있을 겁니다. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
이런 암호화와 폼필드에 대해 더 읽고싶다면, <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST" class="external-link" target="_blank"><abbr title="Mozilla Developer Network">MDN</abbr> web docs for <code>POST</code></a>을 참고하세요. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
!!! warning "주의" | ||||||
*경로 동작*에서 다양한 폼 파라미터를 선언할 수 있지만 요청은 `application/json` 대신에 `application/x-www-form-urlencoded`을 이용해 암호화 된 본문을 가지기 때문에 JSON으로 받기를 예상하는 `본문`필드 또한 선언할 수 없습니다. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
이는 **FastAPI**의 한계가 아니라 HTTP 통신의 일부입니다. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
The origin document separates the sentence by using comma( |
||||||
|
||||||
## 요약 | ||||||
|
||||||
입력 매개변수로 폼 데이터를 선언할 때에는 `Form`을 사용하세요. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Check #2017 . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
Form
is a syntax of FastAPI.