forked from lcosmin/boardgamegeek
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/feat/init_marketplace'
- Loading branch information
Showing
8 changed files
with
3,382 additions
and
1,592 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
.. moduleauthor:: Cosmin Luță <[email protected]> | ||
""" | ||
|
||
import datetime | ||
import html | ||
import logging | ||
import threading | ||
|
@@ -443,3 +443,24 @@ def get_board_game_version_from_element(xml_elem): | |
) | ||
|
||
return data | ||
|
||
|
||
def get_marketplace_listing_from_element(xml_elem): | ||
try: | ||
list_date_string = xml_subelement_attr(xml_elem, "listdate") | ||
list_date = datetime.datetime.strptime( | ||
list_date_string, "%a, %d %b %Y %H:%M:%S %z" | ||
) | ||
except ValueError: | ||
list_date = None | ||
|
||
data = { | ||
"list_date": list_date, | ||
"price": xml_subelement_attr(xml_elem, "price", convert=float, default=0.0), | ||
"currency": xml_subelement_attr(xml_elem, "price", attribute="currency"), | ||
"condition": xml_subelement_attr(xml_elem, "condition"), | ||
"notes": xml_subelement_attr(xml_elem, "notes"), | ||
"link": xml_subelement_attr(xml_elem, "link", attribute="href"), | ||
} | ||
|
||
return data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.