mirror of
https://github.com/NovaOSS/nova-api.git
synced 2024-11-25 22:53:57 +01:00
29 lines
639 B
Python
29 lines
639 B
Python
|
import os
|
||
|
|
||
|
from dotenv import load_dotenv
|
||
|
from typing import Union, Optional
|
||
|
|
||
|
load_dotenv()
|
||
|
|
||
|
EXCLUDED_HEADERS = [
|
||
|
'content-encoding',
|
||
|
'content-length',
|
||
|
'transfer-encoding',
|
||
|
'connection'
|
||
|
]
|
||
|
|
||
|
class Request:
|
||
|
def __init__(self,
|
||
|
url: str,
|
||
|
method: str='GET',
|
||
|
payload: Optional[Union[dict, list]]=None,
|
||
|
headers: dict={
|
||
|
'Content-Type': 'application/json'
|
||
|
}
|
||
|
):
|
||
|
self.method = method.upper()
|
||
|
self.url = url.replace('/v1/v1', '/v1')
|
||
|
self.payload = payload
|
||
|
self.headers = headers
|
||
|
self.timeout = int(os.getenv('TRANSFER_TIMEOUT', '120'))
|