feat(parsers): add SOAP API support for zakupki.gov.ru
- Add post() method to BaseHTTPClient for SOAP requests - Update download_file() to support custom headers (for token) - Add ZAKUPKI_TOKEN and PARSER_PROXIES settings - Improve SOAP error parsing to show EIS error messages - Update E2E tests to use token from settings - Add data/ and .zed/ to gitignore
This commit is contained in:
@@ -16,11 +16,17 @@ import unittest
|
||||
from apps.parsers.clients.zakupki import ZakupkiClient
|
||||
from apps.parsers.models import ParserLoadLog, ProcurementRecord
|
||||
from apps.parsers.services import ParserLoadLogService, ProcurementService
|
||||
from django.conf import settings
|
||||
from django.test import TestCase, override_settings
|
||||
|
||||
# Флаг для запуска E2E тестов
|
||||
RUN_E2E_TESTS = os.environ.get("RUN_E2E_TESTS", "").lower() in ("1", "true", "yes")
|
||||
|
||||
# Токен из settings (или переменной окружения)
|
||||
ZAKUPKI_TOKEN = getattr(settings, "ZAKUPKI_TOKEN", "") or os.environ.get(
|
||||
"ZAKUPKI_TOKEN", ""
|
||||
)
|
||||
|
||||
|
||||
@unittest.skipUnless(RUN_E2E_TESTS, "E2E tests disabled. Set RUN_E2E_TESTS=1 to enable")
|
||||
class ZakupkiClientE2ETestCase(TestCase):
|
||||
@@ -32,7 +38,7 @@ class ZakupkiClientE2ETestCase(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
"""Подготовка."""
|
||||
self.client = ZakupkiClient(timeout=60)
|
||||
self.client = ZakupkiClient(token=ZAKUPKI_TOKEN, timeout=60)
|
||||
|
||||
def tearDown(self):
|
||||
"""Очистка."""
|
||||
@@ -103,7 +109,7 @@ class ProcurementServiceE2ETestCase(TestCase):
|
||||
)
|
||||
|
||||
# Загрузка данных
|
||||
with ZakupkiClient(timeout=60) as client:
|
||||
with ZakupkiClient(token=ZAKUPKI_TOKEN, timeout=60) as client:
|
||||
procurements = client.fetch_procurements(
|
||||
region_code="77",
|
||||
year=2025,
|
||||
|
||||
Reference in New Issue
Block a user