mirror of https://github.com/Bunsly/JobSpy
fixed location empty on goozali
parent
5befc16ea8
commit
0bb64a1fc3
|
@ -166,7 +166,7 @@ class Country(Enum):
|
||||||
valid_countries = [country.value for country in cls]
|
valid_countries = [country.value for country in cls]
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Invalid country string: '{country_str}'. Valid countries are: {
|
f"Invalid country string: '{country_str}'. Valid countries are: {
|
||||||
', '.join([country[0] for country in valid_countries])}"
|
', '.join([country[0] for country in valid_countries])}"
|
||||||
)
|
)
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
|
@ -196,8 +196,8 @@ class Location(BaseModel):
|
||||||
if isinstance(self.country, str):
|
if isinstance(self.country, str):
|
||||||
location_parts.append(self.country)
|
location_parts.append(self.country)
|
||||||
elif self.country and self.country not in (
|
elif self.country and self.country not in (
|
||||||
Country.US_CANADA,
|
Country.US_CANADA,
|
||||||
Country.WORLDWIDE,
|
Country.WORLDWIDE,
|
||||||
):
|
):
|
||||||
country_name = self.country.value[0]
|
country_name = self.country.value[0]
|
||||||
if "," in country_name:
|
if "," in country_name:
|
||||||
|
@ -206,6 +206,10 @@ class Location(BaseModel):
|
||||||
location_parts.append(country_name.upper())
|
location_parts.append(country_name.upper())
|
||||||
else:
|
else:
|
||||||
location_parts.append(country_name.title())
|
location_parts.append(country_name.title())
|
||||||
|
|
||||||
|
if (len(location_parts) == 0 and len(self.text) > 0):
|
||||||
|
return self.text
|
||||||
|
|
||||||
return ", ".join(location_parts)
|
return ", ".join(location_parts)
|
||||||
|
|
||||||
def model_dump(self):
|
def model_dump(self):
|
||||||
|
@ -254,7 +258,6 @@ class DescriptionFormat(Enum):
|
||||||
|
|
||||||
|
|
||||||
class JobPost(BaseModel):
|
class JobPost(BaseModel):
|
||||||
|
|
||||||
# def __init__(self, obj):
|
# def __init__(self, obj):
|
||||||
# super().__init__()
|
# super().__init__()
|
||||||
# for key, value in obj.items():
|
# for key, value in obj.items():
|
||||||
|
|
Loading…
Reference in New Issue