glygener / glygen-issues

Repository for public GlyGen tickets
GNU General Public License v3.0
0 stars 0 forks source link

Test frontend API logging (Python) #1000

Closed ReneRanzinger closed 5 months ago

ReneRanzinger commented 5 months ago

Based on #999 try to extract the header from the WS call to identify the frontend.

Python examples:

Dependencies:

Blocker for:

rykahsay commented 5 months ago

I am using the following code to capture various headers:

   header_dict = {}
    header_dict["user_agent"] = request.headers.get('User-Agent')
    header_dict["referer"] = request.headers.get('referer')
    header_dict["origin"] = request.headers.get('Origin')
    header_dict["ip"] = request.environ.get('HTTP_X_FORWARDED_FOR', request.remote_addr)

    ug = parse(request.headers.get('User-Agent'))
    header_dict["is_bot"] = ug.is_bot

And the captured header parameters look as follows (I hope these will be enough to analyze API requests):

"headers": {
        "user_agent": "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm) Chrome/112.0.0.0 Safari/537.36",
        "referer": "https://www.glygen.org/",
        "origin": "https://www.glygen.org",
        "ip": "40.77.190.238",
        "is_bot": true
    }
ReneRanzinger commented 5 months ago

Why is this ticket assigned to me? If there are questions please ask them. If there is anything for me to do let me know. If this task is done and its a blocker for frontend tasks - tag Sujeet and close the ticket.

rykahsay commented 5 months ago

I thought whoever created the ticket is responsible for closing it. Anyways, I am closing it.