Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 24 for We (0.21 sec)

  1. docs_src/dependencies/tutorial008d.py

    app = FastAPI()
    
    
    class InternalError(Exception):
        pass
    
    
    def get_username():
        try:
            yield "Rick"
        except InternalError:
            print("We don't swallow the internal error here, we raise again 😎")
            raise
    
    
    @app.get("/items/{item_id}")
    def get_item(item_id: str, username: str = Depends(get_username)):
        if item_id == "portal-gun":
            raise InternalError(
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 694 bytes
    - Viewed (0)
  2. docs_src/dependencies/tutorial008d_an.py

    app = FastAPI()
    
    
    class InternalError(Exception):
        pass
    
    
    def get_username():
        try:
            yield "Rick"
        except InternalError:
            print("We don't swallow the internal error here, we raise again 😎")
            raise
    
    
    @app.get("/items/{item_id}")
    def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
        if item_id == "portal-gun":
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 744 bytes
    - Viewed (0)
  3. docs_src/dependencies/tutorial008d_an_py39.py

    app = FastAPI()
    
    
    class InternalError(Exception):
        pass
    
    
    def get_username():
        try:
            yield "Rick"
        except InternalError:
            print("We don't swallow the internal error here, we raise again 😎")
            raise
    
    
    @app.get("/items/{item_id}")
    def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
        if item_id == "portal-gun":
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 734 bytes
    - Viewed (0)
  4. docs/sts/web-identity.py

        id_token_response = requests.post(
            token_url, data=data, verify=False,
            allow_redirects=False, auth=(client_id, client_secret))
    
        print('body: ' + id_token_response.text)
    
        # we can now use the id_token as much as we want to access protected resources.
        tokens = json.loads(id_token_response.text)
        id_token = tokens['id_token']
    
        response = sts_client.assume_role_with_web_identity(
    Python
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Wed Jul 28 01:37:51 GMT 2021
    - 2.9K bytes
    - Viewed (1)
  5. tests/test_security_oauth2.py

            }
        }
    )
    
    
    class User(BaseModel):
        username: str
    
    
    # Here we use string annotations to test them
    def get_current_user(oauth_header: "str" = Security(reusable_oauth2)):
        user = User(username=oauth_header)
        return user
    
    
    @app.post("/login")
    # Here we use string annotations to test them
    def login(form_data: "OAuth2PasswordRequestFormStrict" = Depends()):
        return form_data
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 10.7K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_response_cookies/test_tutorial002.py

    client = TestClient(app)
    
    
    def test_path_operation():
        response = client.post("/cookie-and-object/")
        assert response.status_code == 200, response.text
        assert response.json() == {"message": "Come to the dark side, we have cookies"}
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Jul 09 18:06:12 GMT 2020
    - 414 bytes
    - Viewed (0)
  7. docs_src/openapi_webhooks/tutorial001.py

        username: str
        monthly_fee: float
        start_date: datetime
    
    
    @app.webhooks.post("new-subscription")
    def new_subscription(body: Subscription):
        """
        When a new user subscribes to your service we'll send you a POST request with this
        data to the URL that you register for the event `new-subscription` in the dashboard.
        """
    
    
    @app.get("/users/")
    def read_users():
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Oct 20 09:00:44 GMT 2023
    - 550 bytes
    - Viewed (0)
  8. fastapi/concurrency.py

        # can create race conditions/deadlocks if the context manager itself
        # has its own internal pool (e.g. a database connection pool)
        # to avoid this we let __exit__ run without a capacity limit
        # since we're creating a new limiter for each call, any non-zero limit
        # works (1 is arbitrary)
        exit_limiter = CapacityLimiter(1)
        try:
            yield await run_in_threadpool(cm.__enter__)
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Mon Dec 25 17:57:35 GMT 2023
    - 1.4K bytes
    - Viewed (0)
  9. docs_src/response_cookies/tutorial002.py

    app = FastAPI()
    
    
    @app.post("/cookie-and-object/")
    def create_cookie(response: Response):
        response.set_cookie(key="fakesession", value="fake-cookie-session-value")
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 272 bytes
    - Viewed (0)
  10. tests/test_tutorial/test_response_cookies/test_tutorial001.py

    client = TestClient(app)
    
    
    def test_path_operation():
        response = client.post("/cookie/")
        assert response.status_code == 200, response.text
        assert response.json() == {"message": "Come to the dark side, we have cookies"}
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Jul 09 18:06:12 GMT 2020
    - 403 bytes
    - Viewed (0)
Back to top