Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 217 for Heroes (0.12 sec)

  1. tests/test_tutorial/test_sql_databases/test_tutorial002.py

            hero_id = response.json()["id"]
            response = client.get(f"/heroes/{hero_id}")
            assert response.status_code == 200, response.text
            assert response.json() == snapshot(
                {"name": "Dead Pond", "age": 30, "id": IsInt()}
            )
    
            # Read all heroes
            # Create more heroes first
            response = client.post(
                "/heroes/",
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 19.9K bytes
    - Viewed (0)
  2. docs_src/sql_databases/tutorial002.py

        offset: int = 0,
        limit: int = Query(default=100, le=100),
    ):
        heroes = session.exec(select(Hero).offset(offset).limit(limit)).all()
        return heroes
    
    
    @app.get("/heroes/{hero_id}", response_model=HeroPublic)
    def read_hero(hero_id: int, session: Session = Depends(get_session)):
        hero = session.get(Hero, hero_id)
        if not hero:
            raise HTTPException(status_code=404, detail="Hero not found")
        return hero
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 2.6K bytes
    - Viewed (0)
  3. docs_src/sql_databases/tutorial002_an_py310.py

    ):
        heroes = session.exec(select(Hero).offset(offset).limit(limit)).all()
        return heroes
    
    
    @app.get("/heroes/{hero_id}", response_model=HeroPublic)
    def read_hero(hero_id: int, session: SessionDep):
        hero = session.get(Hero, hero_id)
        if not hero:
            raise HTTPException(status_code=404, detail="Hero not found")
        return hero
    
    
    @app.patch("/heroes/{hero_id}", response_model=HeroPublic)
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 2.5K bytes
    - Viewed (0)
  4. docs_src/sql_databases/tutorial001_an_py39.py

        create_db_and_tables()
    
    
    @app.post("/heroes/")
    def create_hero(hero: Hero, session: SessionDep) -> Hero:
        session.add(hero)
        session.commit()
        session.refresh(hero)
        return hero
    
    
    @app.get("/heroes/")
    def read_heroes(
        session: SessionDep,
        offset: int = 0,
        limit: Annotated[int, Query(le=100)] = 100,
    ) -> list[Hero]:
        heroes = session.exec(select(Hero).offset(offset).limit(limit)).all()
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 1.7K bytes
    - Viewed (0)
  5. scripts/playwright/sql_databases/image01.py

        # Update the viewport manually
        context = browser.new_context(viewport={"width": 960, "height": 1080})
        page = context.new_page()
        page.goto("http://localhost:8000/docs")
        page.get_by_label("post /heroes/").click()
        # Manually add the screenshot
        page.screenshot(path="docs/en/docs/img/tutorial/sql-databases/image01.png")
    
        # ---------------------
        context.close()
        browser.close()
    
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 1.1K bytes
    - Viewed (0)
  6. scripts/playwright/sql_databases/image02.py

        # Update the viewport manually
        context = browser.new_context(viewport={"width": 960, "height": 1080})
        page = context.new_page()
        page.goto("http://localhost:8000/docs")
        page.get_by_label("post /heroes/").click()
        # Manually add the screenshot
        page.screenshot(path="docs/en/docs/img/tutorial/sql-databases/image02.png")
    
        # ---------------------
        context.close()
        browser.close()
    
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 1.1K bytes
    - Viewed (0)
  7. docs/pt/docs/tutorial/sql-databases.md

    </details>
    
    Aqui, usamos a dependência `SessionDep` (uma `Session`) para adicionar o novo `Hero` à instância `Session`, fazer commit das alterações no banco de dados, atualizar os dados no `hero` e então retorná-lo.
    
    ### Ler Heroes
    
    Podemos **ler** `Hero`s do banco de dados usando um `select()`. Podemos incluir um `limit` e `offset` para paginar os resultados.
    
    {* ../../docs_src/sql_databases/tutorial001_an_py310.py ln[48:55] hl[51:52,54] *}
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 27 15:25:29 UTC 2024
    - 15.8K bytes
    - Viewed (0)
  8. docs/en/docs/tutorial/sql-databases.md

    </details>
    
    Here we use the `SessionDep` dependency (a `Session`) to add the new `Hero` to the `Session` instance, commit the changes to the database, refresh the data in the `hero`, and then return it.
    
    ### Read Heroes
    
    We can **read** `Hero`s from the database using a `select()`. We can include a `limit` and `offset` to paginate the results.
    
    {* ../../docs_src/sql_databases/tutorial001_an_py310.py ln[48:55] hl[51:52,54] *}
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 14.7K bytes
    - Viewed (0)
  9. docs/fr/docs/features.md

    * Validation pour des types plus exotiques, tel que:
        * URL.
        * Email.
        * UUID.
        * ...et autres.
    
    Toutes les validations sont gérées par le bien établi et robuste **Pydantic**.
    
    ### Sécurité et authentification
    
    La sécurité et l'authentification sont intégrées. Sans aucun compromis avec les bases de données ou les modèles de données.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Aug 06 04:48:30 UTC 2024
    - 11.1K bytes
    - Viewed (0)
  10. internal/amztime/iso8601_time.go

    func ISO8601Format(t time.Time) string {
    	value := t.Format(iso8601TimeFormat)
    	if len(value) < len(iso8601TimeFormat) {
    		value = t.Format(iso8601TimeFormat[:len(iso8601TimeFormat)-1])
    		// Pad necessary zeroes to full-fill the iso8601TimeFormat
    		return value + strings.Repeat("0", (len(iso8601TimeFormat)-1)-len(value)) + "Z"
    	}
    	return value
    }
    
    // ISO8601Parse parses ISO8601 date string
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Mon Jan 16 23:38:33 UTC 2023
    - 1.9K bytes
    - Viewed (0)
Back to top