This was a task to implement unit support until I realized that Pywikibot currently crashes on items that have quantities with units on it!! You'll get:
NotImplementedError: Currently only unit-less quantities are supported <type 'exceptions.NotImplementedError'> CRITICAL: Closing network session.
Units just got deployed to Wikidata. Pywikibot should also implement support for units. Looks like WbQuantity is already prepared, but not completed for this:
class WbQuantity(object): """A Wikibase quantity representation.""" def __init__(self, amount, unit=None, error=None): u""" Create a new WbQuantity object. @param amount: number representing this quantity @type amount: float @param unit: not used (only unit-less quantities are supported) @param error: the uncertainty of the amount (e.g. Â±1) @type error: float, or tuple of two floats, where the first value is the upper error and the second is the lower error value.
The unit should be a Wikidata item.