Repository navigation
Release v1.0.0
Mockaroo-Python v1.0.0 π¦+ π
π Initial Release π
This Python package is designed to simplify your interactions with Mockaroo APIs, streamlining how you work with mock data.
Features
Retrieve Data Types
Use the types() method to list all supported data types by Mockaroo.
# import package
from mockaroo import Client
# Pass your API key to the class
client = Client(api_key='YOUR_API_KEY')
# Or set an enviornment variable. `export API_KEY=your_api_key_here`
client = Client()
types = client.types()List of available types here
Upload Datasets to Mockaroo
With the upload() function, you can easily upload datasets to Mockaroo for later use.
result = client.upload(name='users', path='path/to/users_dataset.csv')
print(result)
{'success', True}Remove Datasets from Mockaroo
You can also remove datasets that you've uploaded to Mockaroo using the delete() function.
result = client.delete(name='users')
print(result)
{'success', True}Generate Datasets
Generate mock datasets either with predefined schemas or with custom fields using the generate() function.
# Using predefined schema
predefined_data = client.generate(schema='your_predefined_schema')
# Using custom fields
result = client.generate(
count=3,
fields=[
{"name": "id", "type": "Row Number"},
{"name": "first_name", "type": "First Name"},
{"name": "last_name", "type": "Last Name"},
{
"name": "job_title",
"type": "Custom List",
"values": ["Manager", "Instructor", "Helper"],
},
],
)
print(result)
[
{
'id': 1,
'first_name': 'Blondie',
'last_name': 'Elbourne',
'job_title': 'Helper'
},
{
'id': 2,
'first_name': 'Ferdinanda',
'last_name': 'Letherbury',
'job_title': 'Instructor'
},
{
'id': 3,
'first_name': 'Thomas',
'last_name': 'Wallen',
'job_title': 'Helper'
}
]Installation
To install, you can use pip:
pip install mockaroo-pythonContributions
I welcome contributions from the community. If you'd like to contribute, please feel free to submit a pull request.
License
This project is licensed under the MIT License.