mirror of
https://github.com/ThePhaseless/Byparr.git
synced 2025-03-15 09:50:20 +08:00
Merge pull request #104 from ThePhaseless/ThePhaseless-patch-1
Fix timestamps
This commit is contained in:
commit
a644d95b39
@ -2,24 +2,21 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from typing import Annotated, Any
|
from typing import Any
|
||||||
|
|
||||||
from fastapi import Body
|
from fastapi import Body
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from src import consts
|
from src import consts
|
||||||
|
|
||||||
|
|
||||||
class LinkRequest(BaseModel):
|
class LinkRequest(BaseModel):
|
||||||
cmd: Annotated[
|
cmd: str = Field(
|
||||||
str,
|
default="request.get",
|
||||||
Body(
|
description="Type of request, currently only supports GET requests. This string is purely for compatibility with FlareSolverr.",
|
||||||
default="request.get",
|
)
|
||||||
description="Type of request, currently only supports GET requests. This string is purely for compatibility with FlareSolverr.",
|
url: str = Field(pattern=r"^https?://", default="https://")
|
||||||
),
|
max_timeout: int = Field(default=60)
|
||||||
]
|
|
||||||
url: Annotated[str, Body(pattern=r"^https?://", default="https://")]
|
|
||||||
max_timeout: Annotated[int, Body(default=60)]
|
|
||||||
|
|
||||||
|
|
||||||
class Solution(BaseModel):
|
class Solution(BaseModel):
|
||||||
@ -51,10 +48,8 @@ class LinkResponse(BaseModel):
|
|||||||
status: str = "ok"
|
status: str = "ok"
|
||||||
message: str
|
message: str
|
||||||
solution: Solution
|
solution: Solution
|
||||||
start_timestamp: Annotated[int, Body(alias="startTimestamp")] = int(
|
start_timestamp: int = Field(alias="startTimestamp", default_factory=lambda: int(time.time() * 1000))
|
||||||
time.time() * 1000
|
end_timestamp: int = Field(alias="endTimestamp", default_factory=lambda: int(time.time() * 1000))
|
||||||
)
|
|
||||||
end_timestamp: Annotated[int, Body(alias="endTimestamp")] = int(time.time() * 1000)
|
|
||||||
version: str = consts.VERSION
|
version: str = consts.VERSION
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
Loading…
x
Reference in New Issue
Block a user