K
K
Kir2020-10-09 15:26:27
Flask
Kir, 2020-10-09 15:26:27

How to get headers from http request?

All good.
Can't get headers. Outputs none.
What am I doing wrong?

def catch_all_get(path):

    host   = request.headers.get('host_addr')
    key    = request.headers.get('key')
    secret = request.headers.get('secret')
    
    print(host)
    print(key)
    print(secret)
    
    url = create_url(path,host,key,secret)

    try:
        response = requests.get(url)
    except:
        print("ERROR")
    finally:
        print(url)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kirillinyakin, 2020-10-09
@kirillinyakin

Since it displays None, then there are no headers, or throw the site, I'll check it myself

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question