Framawiki added a comment.

>>> import datetime
>>> import memento_client
>>> mc = memento_client.MementoClient()
>>> when = datetime.datetime.now()
>>> url = ""
>>> memento_info = mc.get_memento_info(url, when)
>>> memento_info
{'mementos': {'last': {'uri': ['http://web.archive.org/web/20110228040245/http://www.fallingrain.com:80/world/YI/2/Dunisice.html'], 'datetime': datetime.datetime(2011, 2, 28, 4, 2, 45)}, 'closest': {'datetime': datetime.datetime(2011, 2, 28, 4, 2, 45), 'uri': [u'http://web.archive.org/web/20110228040245/http://www.fallingrain.com:80/world/YI/2/Dunisice.html'], 'http_status_code': 404}, 'first': {'uri': ['http://web.archive.org/web/20071001061940/http://www.fallingrain.com/world/YI/2/Dunisice.html'], 'datetime': datetime.datetime(2007, 10, 1, 6, 19, 40)}}, 'original_uri': 'http://www.fallingrain.com/world/YI/2/Dunisice.html', 'timegate_uri': 'http://timetravel.mementoweb.org/timegate/http://www.fallingrain.com/world/YI/2/Dunisice.html'}
>>> mementos = memento_info.get('mementos')
>>> mementos
{'last': {'uri': ['http://web.archive.org/web/20110228040245/http://www.fallingrain.com:80/world/YI/2/Dunisice.html'], 'datetime': datetime.datetime(2011, 2, 28, 4, 2, 45)}, 'closest': {'datetime': datetime.datetime(2011, 2, 28, 4, 2, 45), 'uri': [u'http://web.archive.org/web/20110228040245/http://www.fallingrain.com:80/world/YI/2/Dunisice.html'], 'http_status_code': 404}, 'first': {'uri': ['http://web.archive.org/web/20071001061940/http://www.fallingrain.com/world/YI/2/Dunisice.html'], 'datetime': datetime.datetime(2007, 10, 1, 6, 19, 40)}}
>>> mementos['closest']['uri'][0]
u'http://web.archive.org/web/20110228040245/http://www.fallingrain.com:80/world/YI/2/Dunisice.html'

Confirmed.
I'll create a task on the mementos's gihthub repo, and upload a temporary hacky patch for pywikibot.


TASK DETAIL
https://phabricator.wikimedia.org/T167463

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Framawiki
Cc: Aklapper, Framawiki, Zoranzoki21, pywikibot-bugs-list, Magul, Tbscho, MayS, Mdupont, JJMC89, Avicennasis, jayvdb, Dalba, Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
pywikibot-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to