geopython / GeoHealthCheck

Service Status and QoS Checker for OGC Web Services
https://geohealthcheck.org
MIT License
84 stars 71 forks source link

Set User-Agent HTTP header on HTTP-requests from Probes #336

Closed justb4 closed 3 years ago

justb4 commented 4 years ago

Is your feature request related to a problem? Please describe. The current GHC/Probe implementation uses default HTTP User-Agent from the Python libs. This is not a web-friendly way to invoke remote web-services.

Describe the solution you'd like Send a clear User-Agent header denoting the GHC project

Describe alternatives you've considered N.A.

Additional context May even add version info. See for example OWSLib:

REQUEST_HEADERS = {
    'User-Agent': 'OWSLib {} (https://geopython.github.io/OWSLib)'.format(__version__)
}

Probe.get_request_headers() is the central function responsible for setting HTTP request headers. Here at least we need to set User-Agent.

Also in the function healthcheck.py:sniff_test_resource() remote services are called.

justb4 commented 3 years ago

User-Agent is more web-friendly also provides some marketing for GHC!

It is also web-friendly to allow compressed responses, so also add like:

'Accept-Encoding': 'deflate, gzip;q=1.0, *;q=0.5'