Fix errors by just returning N/A
This commit is contained in:
parent
9643ba71b8
commit
2113203be1
@ -90,37 +90,55 @@ async def get_ship(ship_name):
|
|||||||
# embed.add_field(name="**Description**", value=ship["description"], inline=False)
|
# embed.add_field(name="**Description**", value=ship["description"], inline=False)
|
||||||
embed.add_field(name="-------", value="", inline=False)
|
embed.add_field(name="-------", value="", inline=False)
|
||||||
|
|
||||||
|
try:
|
||||||
stowage_capacity = (
|
stowage_capacity = (
|
||||||
soup.find("tr", {"class": "data-stowagespace infobox-data infobox-col2"})
|
soup.find(
|
||||||
|
"tr", {"class": "data-stowagespace infobox-data infobox-col2"}
|
||||||
|
)
|
||||||
.findChildren("td")[0]
|
.findChildren("td")[0]
|
||||||
.text
|
.text
|
||||||
)
|
)
|
||||||
|
except Exception:
|
||||||
|
stowage_capacity = "N/A"
|
||||||
|
|
||||||
embed.add_field(
|
embed.add_field(
|
||||||
name="**Stowage Capacity**", value=stowage_capacity, inline=True
|
name="**Stowage Capacity**", value=stowage_capacity, inline=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
cargo_capacity = (
|
cargo_capacity = (
|
||||||
soup.find("tr", {"class": "data-cargocapacity infobox-data infobox-col4"})
|
soup.find(
|
||||||
|
"tr", {"class": "data-cargocapacity infobox-data infobox-col4"}
|
||||||
|
)
|
||||||
.findChildren("td")[0]
|
.findChildren("td")[0]
|
||||||
.text
|
.text
|
||||||
)
|
)
|
||||||
|
except Exception:
|
||||||
|
cargo_capacity = "N/A"
|
||||||
|
|
||||||
embed.add_field(name="**Cargo Capacity**", value=cargo_capacity, inline=True)
|
embed.add_field(name="**Cargo Capacity**", value=cargo_capacity, inline=True)
|
||||||
|
|
||||||
|
try:
|
||||||
crew_size = (
|
crew_size = (
|
||||||
soup.find("tr", {"class": "data-crew infobox-data infobox-col4"})
|
soup.find("tr", {"class": "data-crew infobox-data infobox-col4"})
|
||||||
.findChildren("td")[0]
|
.findChildren("td")[0]
|
||||||
.text
|
.text
|
||||||
)
|
)
|
||||||
|
except Exception:
|
||||||
|
crew_size = "N/A"
|
||||||
|
|
||||||
embed.add_field(name="**Crew Size**", value=crew_size, inline=True)
|
embed.add_field(name="**Crew Size**", value=crew_size, inline=True)
|
||||||
embed.add_field(name="-------", value="", inline=False)
|
embed.add_field(name="-------", value="", inline=False)
|
||||||
|
|
||||||
|
try:
|
||||||
claim_time = (
|
claim_time = (
|
||||||
soup.find("div", {"class": "data-claimtime infobox-data infobox-col4"})
|
soup.find("div", {"class": "data-claimtime infobox-data infobox-col4"})
|
||||||
.find("div", {"class": "infobox-data__value"})
|
.find("div", {"class": "infobox-data__value"})
|
||||||
.text
|
.text
|
||||||
)
|
)
|
||||||
|
except Exception:
|
||||||
|
claim_time = "N/A"
|
||||||
|
|
||||||
embed.add_field(name="**Insurance claim time**", value=claim_time, inline=True)
|
embed.add_field(name="**Insurance claim time**", value=claim_time, inline=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -131,24 +149,24 @@ async def get_ship(ship_name):
|
|||||||
.find("div", {"class": "infobox-data__value"})
|
.find("div", {"class": "infobox-data__value"})
|
||||||
.text
|
.text
|
||||||
)
|
)
|
||||||
|
except Exception:
|
||||||
|
expedited_claim_time = "N/A"
|
||||||
embed.add_field(
|
embed.add_field(
|
||||||
name="**Expedite claim time**", value=expedited_claim_time, inline=True
|
name="**Expedite claim time**", value=expedited_claim_time, inline=True
|
||||||
)
|
)
|
||||||
except Exception as e:
|
|
||||||
print(e)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
expedited_fee = (
|
expedite_fee = (
|
||||||
soup.find(
|
soup.find(
|
||||||
"div", {"class": "data-expeditecost infobox-data infobox-col2"}
|
"div", {"class": "data-expeditecost infobox-data infobox-col2"}
|
||||||
)
|
)
|
||||||
.find("div", {"class": "infobox-data__value"})
|
.find("div", {"class": "infobox-data__value"})
|
||||||
.text
|
.text
|
||||||
)
|
)
|
||||||
embed.add_field(name="**Expedite Fee**", value=expedited_fee, inline=True)
|
except Exception:
|
||||||
except Exception as e:
|
expedite_fee = "N/A"
|
||||||
print(e)
|
|
||||||
pass
|
embed.add_field(name="**Expedite Fee**", value=expedite_fee, inline=True)
|
||||||
|
|
||||||
embed.add_field(
|
embed.add_field(
|
||||||
name="**Link**", value="%s%s" % (wiki_url, wiki_ship_name), inline=False
|
name="**Link**", value="%s%s" % (wiki_url, wiki_ship_name), inline=False
|
||||||
@ -164,7 +182,6 @@ async def get_ship(ship_name):
|
|||||||
% ship_name,
|
% ship_name,
|
||||||
inline=True,
|
inline=True,
|
||||||
)
|
)
|
||||||
print(e)
|
|
||||||
return embed
|
return embed
|
||||||
|
|
||||||
return embed
|
return embed
|
||||||
|
Loading…
x
Reference in New Issue
Block a user