codekingpro/portable-devtools
115k
1import httpagentparser as hap2 3class JakartaHTTPClinet(hap.Browser):4 name = 'Jakarta Commons-HttpClient'5 look_for = name6 version_splitters = ['/']7 8class PythonRequests(hap.Browser):9 name = 'Python Requests'10 look_for = 'python-requests'11 12# Registering new UAs13 14hap.detectorshub.register(JakartaHTTPClinet())15hap.detectorshub.register(PythonRequests())16 17# Tests18 19if __name__ == '__main__':20 21 s = 'Jakarta Commons-HttpClient/3.1'22 23 print(hap.detect(s))24 print(hap.simple_detect(s))25 26 s = 'python-requests/1.2.3 CPython/2.7.4 Linux/3.8.0-29-generic'27 28 print(hap.detect(s))29 print(hap.simple_detect(s))30 