def __modify_schema__(cls, field_schema: Dict[str, Any]) -> None: """Modify the field schema entry. Args: field_schema (Dict[str, Any]): The current field schema. """ AnyHttpUrl.__modify_schema__(field_schema)
def endpoint(self) -> str: return AnyHttpUrl.build( scheme="http", host=self.DIRECTOR_HOST, port=f"{self.DIRECTOR_PORT}", path=f"/{self.DIRECTOR_V0_VTAG}", )
def endpoint(self) -> str: return AnyHttpUrl.build( scheme="http", host=self.host, port=f"{self.port}", path=f"/{self.vtag}", )
def _build_url(self, prefix: str) -> str: prefix = prefix.upper() return AnyHttpUrl.build( scheme="http", host=getattr(self, f"{prefix}_HOST"), port=f"{getattr(self, f'{prefix}_PORT')}", path=f"/{getattr(self, f'{prefix}_VTAG')}", )
def autofill_url(cls, v, values): if v is None: return AnyHttpUrl.build( scheme="http", host=values["host"], port=f"{values['port']}", path=f"/{values['vtag']}", ) return v
def validate(cls, value: Any, field: ModelField, config: BaseConfig) -> furl: """Validate and parse the given URL string value. Args: value (Any): The URL provided by a user. field (ModelField): The field instance the URL is using. config (BaseConfig): The config instance the URL is in. Returns: :class:`furl.furl.furl`: The furl instance of the given URL string. """ AnyHttpUrl.validate(value, field, config) return furl(url=value)
def format_url(cls, v: AnyHttpUrl): return v.rstrip('/') + '/'
def _validate_api_url(cls, v: AnyHttpUrl) -> AnyHttpUrl: return parse_obj_as(AnyHttpUrl, v.rstrip("/"))