(element, xpath='./atom:updated')
return dateutil_parser.parse(timestamp_elems[0].text, tzinfos=tzinfos)
Returns a datetime instance of the text at the given xpath.

    >>> element = etree.XML('''<feed xmlns="http://www.w3.org/2005/Atom">
    ...     <updated>2018-05-15T14:02:08Z</updated>
    ... </feed>''')
    >>> get_timestamp(element)
    datetime.datetime(2018, 5, 15, 14, 2, 8, tzinfo=tzutc())
Returns a datetime instance of the text at the given xpath.
Returns a datetime instance of the text at the given xpath .
def get_timestamp(element, xpath='./atom:updated'):
    """
    Returns a datetime instance of the text at the given xpath.

    >>> element = etree.XML('''<feed xmlns="http://www.w3.org/2005/Atom">
    ...     <updated>2018-05-15T14:02:08Z</updated>
    ... </feed>''')
    >>> get_timestamp(element)
    datetime.datetime(2018, 5, 15, 14, 2, 8, tzinfo=tzutc())

    """
    timestamp_elems = element.xpath(xpath, namespaces={'atom': 'http://www.w3.org/2005/Atom'})
    if not timestamp_elems:
        raise ValueError(f'XPath "{xpath}" not found')
    if len(timestamp_elems) != 1:
        raise ValueError(f'XPath "{xpath}" matched multiple nodes')
    tzinfos = {'UTC': tzutc()}
    return dateutil_parser.parse(timestamp_elems[0].text, tzinfos=tzinfos)
def get_timestamp ( element , xpath = './atom:updated' ) : timestamp_elems = element . xpath ( xpath , namespaces = { 'atom' : 'http://www.w3.org/2005/Atom' } ) if not timestamp_elems : raise ValueError ( f'XPath "{xpath}" not found' ) if len ( timestamp_elems ) != 1 : raise ValueError ( f'XPath "{xpath}" matched multiple nodes' ) tzinfos = { 'UTC' : tzutc ( ) } return dateutil_parser . parse ( timestamp_elems [ 0 ] . text , tzinfos = tzinfos )