MobilityData/gtfs-realtime-bindings

Python - Can't add the header text to an alert

Closed this issue · 1 comments

I am trying to add a header text to the allerts that I am generating programmatically using python in this way:

feedheader = feed.header
feedheader.gtfs_realtime_version = "2.0"
feedheader.timestamp = int(time.time())
feedheader.incrementality = 0  

avvisi = getAvvisi()
    for avviso in avvisi:
        entity = feed.entity.add()
        alert = entity.alert
        entity.id = str(avviso["id"])

        timerange = alert.active_period.add()
        timerange.start = avviso["data"]
        timerange.end = avviso["dataTerminePubblicazione"]

        alert.cause = 1 
        alert.effect = 8 

        for linea in getLineeAvviso(avviso["id"]):
            entityselector = alert.informed_entity.add()
            entityselector.route_id = str(linea["id"])
            entityselector.agency_id = linea["fk_linea"]

        header = alert.header_text

        header = "test"

For some reason the result does not contain the alert header. Am I doing something wrong?

This issue has already been described here

@GianlucaDeStefano Have you tried the solution to the StackOverflow post at https://stackoverflow.com/a/54468629/937715?