ssllabs.client¶
-
class
ssllabs.client.
Client
(entrypoint='https://api.ssllabs.com/api/v2')[source]¶ Bases:
object
The main entry point of this module, used to run analysis and get data
-
analyze
(host, publish=False, ignoreMismatch=False)[source]¶ A generator that iteratively calls analyze on a host until it is done or errored.
Does not return the host structure, but sets it to the object for recalling with the
host()
property. When you run this, you must iterate it to completion before trying to access the host property. You can do this with a loop like:for data in client.analyze("https://example.com"): time.sleep(10)
It is done this way to enable the user to construct their own asynchronous setups if they wish, without enforcing a specific framework or language version. For instance, a proper async coroutine for python 3.5 could be constructed to do this something like this:
from ssllabs.client import Client import asyncio async def analyze(hostname): client = Client() for data in client.analyze(hostname): await asyncio.sleep(10) return client.host
This will let you check multiple endpoints at once, or run the analysis while doing other work.
The data yielded is the same form as the data put into the host property, but is expected to be incomplete; in particular, there will be no EndpointDetails. You can use this data to possibly provide an ETA and progress bar, however. It is quite fancy.
Raises: - ssllabs.errors.ResponseError – subclass if an error was encountered with a known code
- requests.HTTPError – if an error was encountered that isn’t a known code, the raw error is returned
Parameters: - host (str) – The host to test
- publish (bool) – Whether to publish the results on the Qualys SSL Labs site
- ignoreMismatch (bool) – Proceed with assessments even when the server certificate doesn’t match the assessment hostname
-
entrypoint
¶ Returns the entrypoint URL.
Because the URL is disassembled on setting and reassembled on getting, the URL may not match the exact string as set, but will semantically match as the same URL (for instance, an empty query string and fragment are identical to absent ones).
Returns: the entrypoint as set with the entrypoint property or __init__ Return type: str
-
host
¶ Gets the host data.
Raises: ssllabs.errors.NoHostError – if a full call to analyze hasn’t been completed Returns: The host object Return type: ssllabs.host.Host
-
info
()[source]¶ Calls the info API endpoint.
Returns: the info data Return type: ssllabs.info.Info
-
statusCodes
()[source]¶ Calls the getStatusCodes API endpoint.
Returns: the StatusCodes data Return type: ssllabs.statuscodes.StatusCodes
-