21 lines
591 B
Python
21 lines
591 B
Python
import requests
|
|
import json
|
|
from base64 import b64encode
|
|
from server.backend.schemas.pydantic import settings
|
|
import pandas as pd
|
|
auth_str = f"{settings.USERNAME}:{settings.PASSWORD}"
|
|
b64_auth_str = b64encode(auth_str.encode("utf-8")).decode("utf-8")
|
|
|
|
session = requests.Session()
|
|
session.headers.update({
|
|
"Authorization": f"Basic {b64_auth_str}",
|
|
"Content-Type": "application/json",
|
|
"Accept": "application/json"
|
|
})
|
|
|
|
def fetch_contragents():
|
|
response = session.post(settings.URL_REPORT, data=json.dumps(data))
|
|
response.raise_for_status()
|
|
return response.status_code
|
|
|