fix: accept nullable message publishers and scoped dev SPB trust
Some checks failed
Mostovik Backend CI/CD / Tests and lint (push) Successful in 3m3s
Mostovik Backend CI/CD / Deploy dev (push) Has been cancelled
Mostovik Backend CI/CD / Deploy and verify internal main (push) Has been cancelled
Mostovik Backend CI/CD / Build linux/amd64 release images (push) Has been cancelled
Some checks failed
Mostovik Backend CI/CD / Tests and lint (push) Successful in 3m3s
Mostovik Backend CI/CD / Deploy dev (push) Has been cancelled
Mostovik Backend CI/CD / Deploy and verify internal main (push) Has been cancelled
Mostovik Backend CI/CD / Build linux/amd64 release images (push) Has been cancelled
This commit is contained in:
@@ -124,7 +124,7 @@ def _message_record(raw, organization, source, fetched_at):
|
||||
guid = _text(raw.get("GUID"), required=True)
|
||||
message_type = _text(raw.get("Тип"), required=True)
|
||||
label = _text(raw.get("ТипНаим"))
|
||||
publisher = _text(raw.get("Публикатор"), required=True)
|
||||
publisher = _text(raw.get("Публикатор"))
|
||||
participants = raw.get("Участники")
|
||||
if not isinstance(participants, list):
|
||||
raise SnapshotValidationError("invalid_checko_participants")
|
||||
@@ -259,5 +259,7 @@ def collect_checko_section(
|
||||
raise SnapshotValidationError(
|
||||
f"checko_collection_failed:{type(exc).__name__}"
|
||||
) from exc
|
||||
except SnapshotValidationError:
|
||||
raise
|
||||
except (ValueError, TypeError, KeyError) as exc:
|
||||
raise SnapshotValidationError("invalid_checko_section_schema") from exc
|
||||
|
||||
@@ -10,6 +10,7 @@ from io import BytesIO, TextIOWrapper
|
||||
from typing import BinaryIO
|
||||
from urllib.parse import urljoin, urlparse
|
||||
|
||||
from apps.parsers.clients.common.structured import EIS_CA_BUNDLE_PATH
|
||||
from apps.parsers.models import ParserSourceArtifact
|
||||
from apps.parsers.registry_http import (
|
||||
limited_bytes,
|
||||
@@ -170,7 +171,9 @@ def download_spb_artifact(
|
||||
)
|
||||
try:
|
||||
with registry_session() as session:
|
||||
# Existing EIS trust is deliberately NOT reused: approval was probe-only.
|
||||
# This session serves only allowlisted SPB requests; MOEX has its own.
|
||||
if getattr(settings, "EXCHANGE_SPB_RUSSIAN_TRUST_ENABLED", False):
|
||||
session.verify = str(EIS_CA_BUNDLE_PATH)
|
||||
with registry_response(session, SPB_INDEX, hosts=SPB_HOSTS) as response:
|
||||
before = discover_spb_date(
|
||||
limited_bytes(response, 4 * 1024**2).decode("utf-8")
|
||||
|
||||
@@ -22194,7 +22194,8 @@
|
||||
"nullable": true
|
||||
},
|
||||
"publisher_identifier": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"participant_identifiers": {
|
||||
"type": "array",
|
||||
@@ -22258,7 +22259,8 @@
|
||||
"nullable": true
|
||||
},
|
||||
"publisher_identifier": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"participant_identifiers": {
|
||||
"type": "array",
|
||||
|
||||
@@ -11,7 +11,7 @@ class CheckoMessagePayloadSerializer(serializers.Serializer):
|
||||
publication_date = serializers.DateField(allow_null=True)
|
||||
message_type = serializers.CharField()
|
||||
message_type_name = serializers.CharField(allow_null=True)
|
||||
publisher_identifier = serializers.CharField()
|
||||
publisher_identifier = serializers.CharField(allow_null=True)
|
||||
participant_identifiers = serializers.ListField(child=serializers.CharField())
|
||||
source_url = serializers.CharField(allow_null=True)
|
||||
fetched_at = RegistryUTCDateTimeField()
|
||||
|
||||
@@ -532,6 +532,9 @@ SRO_MAX_REQUESTS_PER_RUN = int(os.getenv("SRO_MAX_REQUESTS_PER_RUN", "10000"))
|
||||
# Public exchange collection bounds; TLS verification stays enabled.
|
||||
EXCHANGE_SPB_MAX_BYTES = 50 * 1024**2
|
||||
EXCHANGE_SPB_MAX_ROWS = 100000
|
||||
EXCHANGE_SPB_RUSSIAN_TRUST_ENABLED = _env_bool(
|
||||
"EXCHANGE_SPB_RUSSIAN_TRUST_ENABLED", default=False
|
||||
)
|
||||
EXCHANGE_MOEX_MAX_RESPONSE_BYTES = 10 * 1024**2
|
||||
EXCHANGE_MOEX_MAX_PAGES = 1000
|
||||
EXCHANGE_MOEX_MAX_REQUESTS = 10000
|
||||
|
||||
Reference in New Issue
Block a user