Package: mockaroo-python
Mockaroo API Python Library 🐍 + 🦘A Python library for theMockaroo APIs. Use this library to generate mock data for testing, simulations, and more.InstallationInstall from PyPl:pipinstallmockaroo-pythonInstall from the GitHub Repository:pipinstallgit+https://github.com/Scarvy/mockaroo-python.gitInstall from Local Source:Clone the repository:gitclonehttps://github.com/Scarvy/mockaroo-python.gitNavigate to the cloned directory:cdmockaroo-pythonInstall the package:pipinstall.PrerequisitesTo use this library, you'll need an API key fromMockaroo website.UsageUse the library in your script or in the command-line.Python Script:frommockarooimportClient# Initialize the client with your API keyclient=Client(api_key="your_api_key_here")# Or set an enviornment variable. `export API_KEY=your_api_key_here`client=Client()# Fetch available types from Mockarootypes=client.types()# Upload a dataset ('csv' or 'txt') to Mockarooclient.upload(name="name_of_dataset",path="/path/to/file.csv")# Remove a dataset from Mockarooclient.delete(name="name_of_dataset")# Generate data using a predefined schemadata=client.generate(schema="name_of_schema")# Alternatively, specify fields to generate custom datadata=client.generate(fields=[{"name":"city","type":"City"},{"name":"street_name","type":"Street Name"}])Command-Line Interface:Usage:python-mmockaroo[OPTIONS]COMMAND[ARGS]...InteractwiththeMockarooAPIs🦘+🐍╭─Options────────────────────────────────────────────────────────────────────────╮
│--helpShowthismessageandexit.│
╰──────────────────────────────────────────────────────────────────────────────────╯
╭─Commands───────────────────────────────────────────────────────────────────────╮
│deleteDeleteadatasetfromMockaroo│
│typesGetMockaroodatatypes│
│uploadUploaddatasettoMockaroo│
╰──────────────────────────────────────────────────────────────────────────────────╯Usage:python-mmockarootypes[OPTIONS]GetMockaroodatatypes╭─Options─────────────────────────────────────────────────────────────────────────╮
│--pager-PPageoutput.│
│--helpShowthismessageandexit.│
╰───────────────────────────────────────────────────────────────────────────────────╯Usage:python-mmockarooupload[OPTIONS]NAMEINPUT_FILEUploaddatasettoMockaroo╭─Options────────────────────────────────────────────────────────────────────────╮
│*NAMETEXT[required]│
│*INPUT_FILEPATH[required]│
│--helpShowthismessageandexit.│
╰──────────────────────────────────────────────────────────────────────────────────╯Usage:python-mmockaroodelete[OPTIONS]NAMEDeleteadatasetfromMockaroo╭─Options────────────────────────────────────────────────────────────────────────╮
│*NAMETEXT[required]│
│--helpShowthismessageandexit.│
╰──────────────────────────────────────────────────────────────────────────────────╯Generate DatasetUsing Predefined SchemasTo generate data based on a schema you've created on Mockaroo's website, specify the schema name as an argument.Example:frommockarooimportClientclient=Client()data=client.generate(schema="Person")print(data){'id':1,'first_name':'Patrizius','last_name':'Van'}Using Custom FieldsPass a list of field definitions to generate data with custom fields. For a full list of available types, see the, seeAPI Reference.Example:result=client.generate(count=2,fields=[{"name":"id","type":"Row Number"},{"name":"transactionType","type":"Custom List","values":["credit","debit"]}])print(result)[{'id':1,'transactionType':'credit'},{'id':2,'transactionType':'debit'}]Mockaroo Types