Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 3 of 3 for ISBN (0.01 seconds)

  1. docs_src/query_params_str_validations/tutorial015_an_py310.py

    app = FastAPI()
    
    data = {
        "isbn-9781529046137": "The Hitchhiker's Guide to the Galaxy",
        "imdb-tt0371724": "The Hitchhiker's Guide to the Galaxy",
        "isbn-9781439512982": "Isaac Asimov: The Complete Stories, Vol. 2",
    }
    
    
    def check_valid_id(id: str):
        if not id.startswith(("isbn-", "imdb-")):
            raise ValueError('Invalid ID format, it must start with "isbn-" or "imdb-"')
        return id
    
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Mar 01 22:02:35 GMT 2025
    - 768 bytes
    - Click Count (0)
  2. docs_src/query_params_str_validations/tutorial015_an_py39.py

    app = FastAPI()
    
    data = {
        "isbn-9781529046137": "The Hitchhiker's Guide to the Galaxy",
        "imdb-tt0371724": "The Hitchhiker's Guide to the Galaxy",
        "isbn-9781439512982": "Isaac Asimov: The Complete Stories, Vol. 2",
    }
    
    
    def check_valid_id(id: str):
        if not id.startswith(("isbn-", "imdb-")):
            raise ValueError('Invalid ID format, it must start with "isbn-" or "imdb-"')
        return id
    
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Mar 01 22:02:35 GMT 2025
    - 781 bytes
    - Click Count (0)
  3. tests/test_tutorial/test_query_params_str_validations/test_tutorial015.py

    def test_get_item(client: TestClient):
        response = client.get("/items?id=isbn-9781529046137")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "id": "isbn-9781529046137",
            "name": "The Hitchhiker's Guide to the Galaxy",
        }
    
    
    def test_get_item_does_not_exist(client: TestClient):
        response = client.get("/items?id=isbn-nope")
        assert response.status_code == 200, response.text
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 20 15:55:38 GMT 2025
    - 5K bytes
    - Click Count (0)
Back to Top