Skip to main content

Generate fake JSON user data and lorem ipsum with a Star Trek theme.

Project description

JSON Trek

Star-Trek-flavored JSON data

Generate fake JSON user data and lorem ipsum with a Star Trek theme.

CI

Fake User Data

JSON Trek can generate user information for the following categories:

  • Username
  • Email address
  • First name
  • Last name
  • Address
    • Street
    • City
    • State
    • Country
    • Zip code
  • Occupation

Install

$ pip install json-trek

Usage

>>> from json_trek import JSONTrek

>>> trek = JSONTrek()

Methods

user_profile(fields: list)

If called without a list of fields, user_profile will generate values for all fields.

Username fields

  • username
  • email
  • first_name
  • last_name
  • occupation
  • address
>>> trek.user_profile() # generate a user profile with all fields

# the output here is formatted for readability
{
  "username": "CyberneticImplant8",
  "email": "SporeDrive48@sector68.fed",
  "first_name": "Mirab",
  "last_name": "Zshaar",
  "occupation": "Xenoanthropologist",
  "address": {
    "street": "665 N. Bomar Hwy.",
    "city": "Nyria III",
    "state": "RT",
    "country": "Tessen III",
    "zipcode": "43974-3953"
  }
}
>>> trek.user_profile([ 'username', 'email' ]) # or, pass a list of the desired user profile fields

# the output here is formatted for readability
{
  "username": "FluxIsolator81",
  "email": "IsodyneRelay17@sector21.trk"
}

username()

Generate a username consisting of two words and a number.

>>> trek.username()
"OrbitalTether35"

email()

Generate an email address. This is the same as the output from username ending with @sector0-100 and ending with .com, .trk, .edu, .fed, or .net

>>> trek.email()
"IconianCombadge48@sector63.net"

get_name(first_or_last: str = 'both')

Generate a first and last name together or each individually.

>>> trek.name()
"K'Kath Lor"

>>> trek.name('first')
"Ilia"

>>> trek.name('last')
"Xerius"

occupation()

Generate an occupation.

>>> trek.occupation('first')
"Chief Medical Officer"

address()

Generate an address with values for street, city, state, country and zipcode.

>>> trek.address()

# the output here is formatted for readability
{
  "street": "75 Aldean St.",
  "city": "Risa",
  "state": "CR",
  "country": "Ganalda IV",
  "zipcode": "73691-9986"
}

ipsum(n: int = 30, lang: str = 'human')

Args:

  • n - minimum number of words to generate (some words come as pairs so the final string might be more than n words.)
  • lang - language in which to generate lorem ipsum text
    • 'human' (default)
    • 'klingon'
>>> trek.ipsum() # generate 30 human words
"Matter synthesizer? Holosuite hovercar runabout kantare? Kelva ithenite nuubari sensor mundahla taresia narva verdanis combadge ardana lothra leyron argosian. Burke? Xindus varro? Eridanus. Xelatian lyssarian hovercar? Cepheus nakan kurlan valakis shuttlecraft!"

>>> trek.ipsum(10, 'klingon') # generate 10 klingon words
"Cha. Jatlh jajvam duj nenchoh pov jaghmeyjaj? Chack toj posmoh!"

Thanks to STAPI for providing a lot of the data used in this project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

json_trek-1.0.9.tar.gz (39.0 kB view hashes)

Uploaded Source

Built Distributions

json_trek-1.0.9-py3.10.egg (42.3 kB view hashes)

Uploaded Source

json_trek-1.0.9-py3-none-any.whl (37.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page