Append header in flask request [duplicate]
Asked Answered
S

0

6

i am using python flask in my application. I want to change the header before each request in order to add information for zipkin distributed tracing. My current code looks like:

@app.before_request
def before_request():
    headers={}
    headers.update(zipkin.create_http_headers_for_new_span())
    request.headers.append(headers)

Unfortunately, this is not working as the method append does not exist. What is the right approach?

Best regards Martin

Sinistrocular answered 2/7, 2018 at 14:14 Comment(1)
@cfreak The link you send me changes the headers in a response. I do not want to add headers in a response. I need to add headers everytime before i send a request. The links you provided is not the solutionSinistrocular

© 2022 - 2025 — McMap. All rights reserved.