Update app.py
Browse files
app.py
CHANGED
@@ -48,17 +48,6 @@ logger = logging.getLogger(__name__)
|
|
48 |
RATE_LIMIT_DELAY = 5 # Delay in seconds between API calls
|
49 |
LAST_REQUEST_TIME = 0
|
50 |
|
51 |
-
class UserRequest(BaseModel):
|
52 |
-
username: str = Field(..., min_length=1, max_length=30)
|
53 |
-
|
54 |
-
@validator("username")
|
55 |
-
def validate_username(cls, value):
|
56 |
-
"""
|
57 |
-
Validate that the username contains only alphanumeric characters, dots, and underscores.
|
58 |
-
"""
|
59 |
-
if not re.match(r"^[a-zA-Z0-9._]+$", value):
|
60 |
-
raise ValueError("Username can only contain alphanumeric characters, dots, and underscores.")
|
61 |
-
return value
|
62 |
|
63 |
@app.post("/fetch-posts")
|
64 |
async def fetch_posts(user: UserRequest):
|
|
|
48 |
RATE_LIMIT_DELAY = 5 # Delay in seconds between API calls
|
49 |
LAST_REQUEST_TIME = 0
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
@app.post("/fetch-posts")
|
53 |
async def fetch_posts(user: UserRequest):
|