State¶
- fakernaija.Naija.state(self, region: str | None = None) dict[str, str]¶
Get a dictionary of random state information, optionally filtered by region.
- Parameters:
region (str | None, optional) – The region abbreviation to filter by.
- Returns:
- Random state information, optionally filtered
by region.
- Return type:
dict[str, str]
- Raises:
ValueError – If the specified region does not exist.
Note
Region options: NW, NE, NC, SW, SE, SS
Examples
>>> from fakernaija import Naija >>> naija = Naija() >>> state = naija.state() >>> print(f"Random state: {state}") Random state: {'code': 'BY', 'name': 'Bayelsa', 'capital': 'Yenagoa', 'slogan': 'Glory of All Lands', 'region': 'South South', 'postal_code': '561001', 'lgas': ['Brass', 'Ekeremor', 'Kolokuma Opokuma', 'Nembe', 'Ogbia', 'Sagbama', 'Southern-Ijaw', 'Yenagoa']} >>> state = naija.state(region="SS") >>> print(f"Random state by region: {state}") Random state by region: {'code': 'BY', 'name': 'Bayelsa', 'capital': 'Yenagoa', 'slogan': 'Glory of All Lands', 'region': 'South South', 'postal_code': '561001', 'lgas': ['Brass', 'Ekeremor', 'Kolokuma Opokuma', 'Nembe', 'Ogbia', 'Sagbama', 'Southern-Ijaw', 'Yenagoa']} >>> for _ in range(2): ... state = naija.state() ... print(f"State name: {state['name']}") ... print(f"State capital: {state['capital']}") ... print(f"State code: {state['code']}") ... print(f"State slogan: {state['slogan']}") ... print() ... State name: Borno State capital: Maiduguri State code: BO State slogan: Home of Peace State name: Oyo State capital: Ibadan State code: OY State slogan: Pace Setter State
- fakernaija.Naija.state_capital(self, region: str | None = None) str¶
Get a random state capital, optionally filtered by region.
- Parameters:
region (str | None, optional) – The region abbreviation to filter by.
- Returns:
Random state capital, optionally filtered by region.
- Return type:
str
- Raises:
ValueError – If the specified region does not exist.
Note
Region options: NW, NE, NC, SW, SE, SS
Examples
>>> from fakernaija import Naija >>> naija = Naija() >>> capital = naija.state_capital() >>> print(f"Random state capital: {capital}") Random state capital: Ikeja >>> for _ in range(3): ... print(naija.state_capital()) ... Uyo Bernin-Kebbi Port-Harcourt >>> capital = naija.state_capital(region="SW") >>> print(f"Random state capital by region: {capital}") Random state capital by region: Ikeja
- fakernaija.Naija.state_lga(self, state: str | None = None) str¶
Get a random LGA, optionally filtered by state.
- Parameters:
state (str | None, optional) – The name of the state to filter by.
- Returns:
- Random LGA in the specified state or any state if
none is specified.
- Return type:
str
- Raises:
ValueError – If the specified state does not exist.
Note
State options: 36 States in Nigeria + FCT.
Examples
>>> from fakernaija import Naija >>> naija = Naija() >>> state_lga = naija.state_lga() >>> print(f"Random State LGA: {state_lga}") Random State LGA: Surulere >>> for _ in range(3): ... print(naija.state_lga()) ... Koko-Besse Ogba-Egbema-Ndoni Ikot-Abasi >>> state_lga = naija.state_lga(state="lagos") >>> print(f"Random State LGA in a specified state: {state_lga}") Random State LGA: Alimosho
- fakernaija.Naija.state_name(self, region: str | None = None) str¶
Get a random state name, optionally filtered by region.
- Parameters:
region (str | None, optional) – The region abbreviation to filter by.
- Returns:
Random state name, optionally filtered by region.
- Return type:
str
- Raises:
ValueError – If the specified region does not exist.
Note
Region options: NW, NE, NC, SW, SE, SS
Examples
>>> from fakernaija import Naija >>> naija = Naija() >>> state_name = naija.state_name() >>> print(f"Random state name: {state_name}") Random state name: Lagos >>> for _ in range(3): ... print(naija.state_name()) ... Borno Katsina Taraba >>> state_name = naija.state_name(region="SW") >>> print(f"Random state name by region: {state_name}") Random state name by region: Ekiti
- fakernaija.Naija.state_postal_code(self, state: str | None = None) str¶
Get a random state postal code.
- Parameters:
state (str | None, optional) – An optional state name.
- Returns:
- Postal code of the specified state or any state if
none is specified.
- Return type:
str
- Raises:
ValueError – If the specified state does not exist.
Note
State options: 36 states in Nigeria + FCT.
Examples
>>> from fakernaija import Naija >>> naija = Naija() >>> postal_code = naija.state_postal_code() >>> print(f"Random postal code: {postal_code}") Random postal code: 100001 >>> for _ in range(3): ... print(naija.state_postal_code()) ... 970001 400001 320001 >>> postal_code = naija.state_postal_code(state="lagos") >>> print(f"Postal code of a state: {postal_code}") Postal code of a state: 100001