Compare commits
2 commits
67ad232533
...
22fa039f1b
Author | SHA1 | Date | |
---|---|---|---|
Rémi Oudin | 22fa039f1b | ||
Théophile Bastian | e4ad8c7ce6 |
|
@ -225,7 +225,6 @@ class PageGetter:
|
|||
scheduler.fetching()
|
||||
async with async_timeout.timeout(10):
|
||||
async with self.session.get(self.url, verify_ssl=ssl) as resp:
|
||||
print("Resp status %s" % resp.status)
|
||||
try:
|
||||
return await resp.text()
|
||||
except UnicodeDecodeError:
|
||||
|
|
|
@ -115,17 +115,25 @@ class History(models.Model):
|
|||
runnner.run()
|
||||
self.save()
|
||||
|
||||
def to_xml(self, xml_root):
|
||||
def to_xml(self, xml_root=None):
|
||||
''' Exports the current history to xml '''
|
||||
standalone = False
|
||||
if xml_root is None:
|
||||
standalone = True
|
||||
xml_root = ET.Element('root')
|
||||
|
||||
hist_node = ET.Element("history", attrib={
|
||||
'start-ts': self.start_ts,
|
||||
'played': 1 if self.played else 0,
|
||||
'user': self.user.pk,
|
||||
})
|
||||
xml_root.append(hist_node)
|
||||
for entry in self.historyentry_set:
|
||||
for entry in self.historyentry_set.all():
|
||||
entry.to_xml(hist_node)
|
||||
|
||||
if standalone:
|
||||
return xml_root
|
||||
|
||||
@staticmethod
|
||||
def from_xml(xml_root):
|
||||
''' Loads an history from an XML file '''
|
||||
|
|
Loading…
Reference in a new issue