Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 102 for Write (0.3 sec)

  1. docs_src/background_tasks/tutorial002_an.py

    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    def write_log(message: str):
        with open("log.txt", mode="a") as log:
            log.write(message)
    
    
    def get_query(background_tasks: BackgroundTasks, q: Union[str, None] = None):
        if q:
            message = f"found query: {q}\n"
            background_tasks.add_task(write_log, message)
        return q
    
    
    @app.post("/send-notification/{email}")
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 725 bytes
    - Viewed (0)
  2. 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)
  3. 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)
  4. tests/test_datastructures.py

        placeholder_a = Default("a")
        placeholder_b = Default("")
        assert placeholder_a
        assert not placeholder_b
    
    
    def test_upload_file_is_closed(tmp_path: Path):
        path = tmp_path / "test.txt"
        path.write_bytes(b"<file content>")
        app = FastAPI()
    
        testing_file_store: List[UploadFile] = []
    
        @app.post("/uploadfile/")
        def create_upload_file(file: UploadFile):
            testing_file_store.append(file)
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Wed Oct 18 12:36:40 GMT 2023
    - 2K bytes
    - Viewed (0)
  5. docs_src/background_tasks/tutorial002.py

    from fastapi import BackgroundTasks, Depends, FastAPI
    
    app = FastAPI()
    
    
    def write_log(message: str):
        with open("log.txt", mode="a") as log:
            log.write(message)
    
    
    def get_query(background_tasks: BackgroundTasks, q: Union[str, None] = None):
        if q:
            message = f"found query: {q}\n"
            background_tasks.add_task(write_log, message)
        return q
    
    
    @app.post("/send-notification/{email}")
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 675 bytes
    - Viewed (0)
  6. docs_src/background_tasks/tutorial001.py

    app = FastAPI()
    
    
    def write_notification(email: str, message=""):
        with open("log.txt", mode="w") as email_file:
            content = f"notification for {email}: {message}"
            email_file.write(content)
    
    
    @app.post("/send-notification/{email}")
    async def send_notification(email: str, background_tasks: BackgroundTasks):
        background_tasks.add_task(write_notification, email, message="some notification")
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 519 bytes
    - Viewed (0)
  7. tests/test_tutorial/test_request_forms_and_files/test_tutorial001.py

                ]
            }
        )
    
    
    def test_post_files_and_token(tmp_path, app: FastAPI):
        patha = tmp_path / "test.txt"
        pathb = tmp_path / "testb.txt"
        patha.write_text("<file content>")
        pathb.write_text("<file b content>")
    
        client = TestClient(app)
        with patha.open("rb") as filea, pathb.open("rb") as fileb:
            response = client.post(
                "/files/",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 9.8K bytes
    - Viewed (0)
  8. .github/workflows/smokeshow.yml

    name: Smokeshow
    
    on:
      workflow_run:
        workflows: [Test]
        types: [completed]
    
    permissions:
      statuses: write
    
    jobs:
      smokeshow:
        if: ${{ github.event.workflow_run.conclusion == 'success' }}
        runs-on: ubuntu-latest
    
        steps:
          - name: Dump GitHub context
            env:
              GITHUB_CONTEXT: ${{ toJson(github) }}
            run: echo "$GITHUB_CONTEXT"
          - uses: actions/setup-python@v5
            with:
    Others
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 19 01:33:28 GMT 2024
    - 1.1K bytes
    - Viewed (0)
  9. SECURITY.md

    # Security Policy
    
    Security is very important for FastAPI and its community. 🔒
    
    Learn more about it below. 👇
    
    ## Versions
    
    The latest version of FastAPI is supported.
    
    You are encouraged to [write tests](https://fastapi.tiangolo.com/tutorial/testing/) for your application and update your FastAPI version frequently after ensuring that your tests are passing. This way you will benefit from the latest features, bug fixes, and **security fixes**.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Sep 11 16:15:49 GMT 2022
    - 1.3K bytes
    - Viewed (0)
  10. docs_src/background_tasks/tutorial002_an_py39.py

    from fastapi import BackgroundTasks, Depends, FastAPI
    
    app = FastAPI()
    
    
    def write_log(message: str):
        with open("log.txt", mode="a") as log:
            log.write(message)
    
    
    def get_query(background_tasks: BackgroundTasks, q: Union[str, None] = None):
        if q:
            message = f"found query: {q}\n"
            background_tasks.add_task(write_log, message)
        return q
    
    
    @app.post("/send-notification/{email}")
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 696 bytes
    - Viewed (0)
Back to top