Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 148 for byte (0.14 sec)

  1. docs/en/docs/tutorial/request-files.md

    * `write(data)`: Writes `data` (`str` or `bytes`) to the file.
    * `read(size)`: Reads `size` (`int`) bytes/characters of the file.
    * `seek(offset)`: Goes to the byte position `offset` (`int`) in the file.
        * E.g., `await myfile.seek(0)` would go to the start of the file.
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Wed Mar 13 19:02:19 GMT 2024
    - 10.2K bytes
    - Viewed (0)
  2. docs_src/security/tutorial007.py

        current_username_bytes = credentials.username.encode("utf8")
        correct_username_bytes = b"stanleyjobson"
        is_correct_username = secrets.compare_digest(
            current_username_bytes, correct_username_bytes
        )
        current_password_bytes = credentials.password.encode("utf8")
        correct_password_bytes = b"swordfish"
        is_correct_password = secrets.compare_digest(
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Jan 11 14:33:05 GMT 2024
    - 1.1K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_request_files/test_tutorial003_an.py

    from docs_src.request_files.tutorial003_an import app
    
    client = TestClient(app)
    
    
    def test_post_files(tmp_path):
        path = tmp_path / "test.txt"
        path.write_bytes(b"<file content>")
        path2 = tmp_path / "test2.txt"
        path2.write_bytes(b"<file content2>")
    
        client = TestClient(app)
        with path.open("rb") as file, path2.open("rb") as file2:
            response = client.post(
                "/files/",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 7.1K bytes
    - Viewed (0)
  4. docs_src/request_files/tutorial001_03_an_py39.py

    from typing import Annotated
    
    from fastapi import FastAPI, File, UploadFile
    
    app = FastAPI()
    
    
    @app.post("/files/")
    async def create_file(file: Annotated[bytes, File(description="A file read as bytes")]):
        return {"file_size": len(file)}
    
    
    @app.post("/uploadfile/")
    async def create_upload_file(
        file: Annotated[UploadFile, File(description="A file read as UploadFile")],
    ):
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 421 bytes
    - Viewed (0)
  5. docs_src/request_files/tutorial003_an_py39.py

    from fastapi import FastAPI, File, UploadFile
    from fastapi.responses import HTMLResponse
    
    app = FastAPI()
    
    
    @app.post("/files/")
    async def create_files(
        files: Annotated[list[bytes], File(description="Multiple files as bytes")],
    ):
        return {"file_sizes": [len(file) for file in files]}
    
    
    @app.post("/uploadfiles/")
    async def create_upload_files(
        files: Annotated[
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 952 bytes
    - Viewed (0)
  6. tests/test_tutorial/test_request_files/test_tutorial002_an.py

                    }
                ]
            }
        )
    
    
    def test_post_files(tmp_path):
        path = tmp_path / "test.txt"
        path.write_bytes(b"<file content>")
        path2 = tmp_path / "test2.txt"
        path2.write_bytes(b"<file content2>")
    
        client = TestClient(app)
        with path.open("rb") as file, path2.open("rb") as file2:
            response = client.post(
                "/files/",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 8.5K bytes
    - Viewed (0)
  7. docs/pt/docs/tutorial/extra-data-types.md

            * Nas respostas, o `set` será convertido para uma `list`.
            * O esquema gerado vai especificar que os valores do `set` são unicos (usando o `uniqueItems` do JSON Schema).
    * `bytes`:
        * O `bytes` padrão do Python.
        * Em requisições e respostas será representado como uma `str`.
        * O esquema gerado vai especificar que é uma `str` com o "formato" `binary`.
    * `Decimal`:
        * O `Decimal` padrão do Python.
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 3K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_custom_response/test_tutorial007.py

    from fastapi.testclient import TestClient
    
    from docs_src.custom_response.tutorial007 import app
    
    client = TestClient(app)
    
    
    def test_get():
        fake_content = b"some fake video bytes"
        response = client.get("/")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jul 09 18:06:12 GMT 2020
    - 264 bytes
    - Viewed (0)
  9. docs_src/request_files/tutorial001.py

    from fastapi import FastAPI, File, UploadFile
    
    app = FastAPI()
    
    
    @app.post("/files/")
    async def create_file(file: bytes = File()):
        return {"file_size": len(file)}
    
    
    @app.post("/uploadfile/")
    async def create_upload_file(file: UploadFile):
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 282 bytes
    - Viewed (0)
  10. docs/ru/docs/tutorial/extra-data-types.md

            * В ответах `set` будет преобразован в `list`.
            * В сгенерированной схеме будет указано, что значения `set` уникальны (с помощью JSON-схемы `uniqueItems`).
    * `bytes`:
        * Встроенный в Python `bytes`.
        * В запросах и ответах будет рассматриваться как `str`.
        * В сгенерированной схеме будет указано, что это `str` в формате `binary`.
    * `Decimal`:
        * Встроенный в Python `Decimal`.
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 4.7K bytes
    - Viewed (0)
Back to top