energyquantified / eq-python-client

Python library for Energy Quantified's Time Series API.
https://energyquantified-python.readthedocs.io/
Apache License 2.0
15 stars 2 forks source link

Temporarily less strict validations in parse_subscription #103

Closed fredriksvendsen closed 8 months ago

fredriksvendsen commented 11 months ago

Because of invalid curve format in push feed messages (see #101 ), parse_subscription() was changed in 61321ea to be less strict. It was changed from:

def parse_subscription(json):
    """
    Parse a JSON response from the server into a Subscription object.
    """
    access = SubscriptionAccess.by_tag(json.get("access"))
    stype = SubscriptionType.by_tag(json.get("type"))

to:

def parse_subscription(json):
    """
    Parse a JSON response from the server into a Subscription object.
    """
    access = json.get("access")
    if access is not None:
        access = SubscriptionAccess.by_tag(access)
    stype = json.get("type")
    if stype is not None:
        stype = SubscriptionType.by_tag(stype)

I assume we want to revert these changes as soon as we are positive that the formatting issue regarding curve subscription is fixed.