mercredi 20 avril 2016

How can I make an accurate user-agent string in python?

I want to test a wsgi application. I want to make an accurate environ variable without making any socket connections or http calls. (If my test framework is the server, and the app lives on the same machine, why make http calls?)

I found webtest and am currently looking at it's source to figure it out (it's not working for google app engine apps for some reason).

My current issue with making an accurate environ variable is the user-agent. I can get system information with import platform; platform.uname(), but it returns Darwin for Macbooks and not Macintosh, which is found in a user-agent string when sent from a macbook. I've found multiple libraries to generate 'fake' user-agents, but I want to make the real one.

Aucun commentaire:

Enregistrer un commentaire