Skip to content

Instantly share code, notes, and snippets.

@codeadict
Last active October 14, 2022 03:34
Show Gist options
  • Save codeadict/9512a87becd0f27e69070ca8b021d350 to your computer and use it in GitHub Desktop.
Save codeadict/9512a87becd0f27e69070ca8b021d350 to your computer and use it in GitHub Desktop.
Planet provider for faker
from faker.providers import BaseProvider
class PlanetProvider(BaseProvider):
__provider__ = 'planet'
__lang___ = 'en_US'
planets = ['Neptune', 'Mars', 'Mercury', 'Venus', 'Earth', 'Jupiter', 'Saturn', 'Uranus']
def planet(self):
return self.random_element(self.planets)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment