Skip to content

EANGenerator generator

Generate EAN-13 product codes, optionally unique within one process.

Why: Use EANGenerator for product fixtures that need EAN-13-shaped identifiers; enable unique only for bounded single-process pools and use a key strategy when global uniqueness is required.

Category: ecommerce.

Output: str.

1
<key name="value" generator="EANGenerator(locale='en_US', unique=True)"/>

Parameters

  • locale: str | null; Default en_US — Faker locale used by the barcode provider.
  • unique: bool; Default False — Whether the in-process Faker provider must avoid repeated EAN values.