Skip to main content

Generate realistic e-commerce test data: products, SKUs, orders, 20+ carriers, 20+ payment methods, coupons, reviews, and more

Project description

faker-ecommerce-provider

PyPI version License

Faker provider for generating realistic e-commerce fake data.

Installation

pip install faker-ecommerce-provider

Usage

from faker import Faker
from faker_ecommerce import EcommerceProvider

fake = Faker()
fake.add_provider(EcommerceProvider)

# Basic usage
fake.product_name()       # 'Premium Leather Electronics Item'
fake.product_name(include_brand=True) # 'Sony Modern Wireless Headphones'
fake.brand_name()         # 'Samsung'
fake.product_description() # 'A modern headphones made with high-quality stainless steel.'
fake.sku()                # 'ABC-1234-XY'
fake.order_id()           # 'ORD-123456789'
fake.tracking_number()    # '1ZABCD1234567890'
fake.tracking_number(carrier="USPS") # '9400100000000000000000'
fake.price()              # '$49.99'
fake.shipping_carrier()   # 'FedEx'
fake.payment_method()     # 'Apple Pay'

# Generate a complete order
order = fake.full_order()
print(order)
# {
#   'order_id': 'ORD-891234567',
#   'product': 'Apple Classic Aluminum Laptop',
#   'sku': 'DLL-4821-KP',
#   'price': '$899.99',
#   'payment_method': 'Credit Card',
#   'customer_type': 'Prime',
#   'status': 'Shipped',
#   'carrier': 'UPS',
#   'tracking_number': '1Z87654...',
#   'review_rating': 5
# }

💡 Tip: Run python showcase.py to see all available features and examples!

Available Methods

Method Example
product_name() Premium Leather Electronics Item
product_name(include_brand=True) Samsung Modern Smartphone
brand_name() Apple, Sony, Nike
product_description() A modern laptop made with high-quality aluminum.
product_category() Electronics, Clothing, Home & Garden
sku() ABC-1234-XY
order_id() ORD-123456789
tracking_number() 1ZABCD1234567890
price() $49.99
discount_percentage() 25%
shipping_carrier() FedEx, UPS, DHL
payment_method() Credit Card, PayPal, Apple Pay
order_status() Pending, Shipped, Delivered
customer_type() Guest, VIP, Prime
return_reason() Wrong Size, Defective
coupon_code() SAVE20
review_rating() 1-5
full_order() Dictionary with complete order details

Running Tests

To run the tests, install the dependencies and run pytest:

pip install .[dev]
pytest tests/

License

MIT

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

faker_ecommerce_provider-1.1.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

faker_ecommerce_provider-1.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file faker_ecommerce_provider-1.1.0.tar.gz.

File metadata

File hashes

Hashes for faker_ecommerce_provider-1.1.0.tar.gz
Algorithm Hash digest
SHA256 d16446cdf07d0f595f6fbe63bcf75a24b87d415359048dd1534d3c77d93c1b4c
MD5 80bfcd6880dea90a2273af6fe94de2ad
BLAKE2b-256 f9ed2a01b1aca790f89d3999c21d16881d1eb3c407e10cc5216ce412492aa44f

See more details on using hashes here.

File details

Details for the file faker_ecommerce_provider-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for faker_ecommerce_provider-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2319a66ccf7200d05e631680829bae01d677d2a30ebcf32c5f628307565102bb
MD5 455f1ff4adf92f1428a7cef55a962fb1
BLAKE2b-256 44e9e722660dcad155e833a835c9cc1baaa67ab9e817ece72f83b45a8be5c04d

See more details on using hashes here.

Supported by

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