User-agent graceful degradation

The newly formatted user-agent string is not compliant with RFC 7231,
as it puts the username at the end, when it should be at the beginning
and leaves '(User:)' in the user-agent if the request was not to a site.

Using a default format string of '{script}/{version} ..' is asking for
the end-user to build a uncompliant user-agent.  We should give them
properly formatted products and product comments.

Provide Pywikibot, httplib2 and Python release versions as products,
and provide script_product and script_comments, populated with the
information currently known about the script.

In the user-agent builder, include in the user-agent whichever components
are available at the time of the request, allowing http.py to be used
by version.py without cyclic dependency runtime exceptions.

Avoid percent-encoding or utf-8 encoding the username unless necessary.

Bug: 55016
Bug: 66102
Change-Id: Iedf28f5e0a216ba23a015924e564ae0537e64f0d
Merge "User-agent graceful degradation"