Last active
October 1, 2020 19:43
-
-
Save gidgid/7d8abb5b0fb63a8b29b839949129ba6a to your computer and use it in GitHub Desktop.
Using HttpUrl with validate_arguments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Optional | |
from pydantic import validate_arguments, HttpUrl, PositiveInt | |
@validate_arguments | |
def better_get_payload( | |
url: HttpUrl, # 1 | |
retries: PositiveInt | |
) -> Optional[dict]: | |
# send the actual request - no need to verify URL # 2 | |
return {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment