spiderweb/spiderweb/request.py
2024-08-14 20:12:11 -04:00

28 lines
634 B
Python

import json
from urllib.parse import urlparse
class Request:
def __init__(
self,
content=None,
body=None,
method=None,
headers=None,
path=None,
query_params=None,
server=None
):
self.content: str = content
self.body: str = body
self.method: str = method
self.headers: dict[str] = headers
self.path: str = path
self.url = urlparse(path)
self.query_params = query_params
self.server = server
self.GET = {}
self.POST = {}
def json(self):
return json.loads(self.content)