Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions src/customio/ns.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ async def _get_quorum(self) -> int:
except HTTPResponseException as e:
raise QueryException(str(e))

async def _parse_approvals(self,approval:etree._Element) -> list[str | None]:
async def _parse_approvals(self,approval:etree.Element) -> list[str | None]:
if approval[0].text == None:
return []
else:
Expand Down Expand Up @@ -112,10 +112,24 @@ async def _query_atvote(self,council:int) -> etree.ElementTree:
try:
xmlstr = await self._make_request(f'http://www.nationstates.net/cgi-bin/api.cgi?wa={council}&q=resolution')
xmltree = etree.fromstring(xmlstr)
resolutions = xmltree.findall('./RESOLUTION')
if len(resolutions) == 0:
resolution_elements = xmltree.findall('./RESOLUTION/')
if len(resolution_elements) == 0:
return None
else:
return resolutions
return resolution_elements
except HTTPResponseException as e:
raise QueryException(str(e))
raise QueryException(str(e))

async def parse_atvote(self, council:int):
xml = await self._query_atvote(council)
parsed_xml = classes.wa.Proposal().fromAttributeValues(
id = 0,
council = 0,
name = '',
category = '',
author = '',
legal = True,
quorum = True,
coauthors = []
)
return parsed_xml
Loading