faker.providers.isbn.en_US

Package Contents

Classes

ISBNProvider

Generates fake ISBNs. ISBN rules vary across languages/regions

Provider

Generates fake ISBNs. ISBN rules vary across languages/regions

class faker.providers.isbn.en_US.ISBNProvider(generator: Any)

Bases: faker.providers.BaseProvider

Generates fake ISBNs. ISBN rules vary across languages/regions so this class makes no attempt at replicating all of the rules. It only replicates the 978 EAN prefix for the English registration groups, meaning the first 4 digits of the ISBN-13 will either be 978-0 or 978-1. Since we are only replicating 978 prefixes, every ISBN-13 will have a direct mapping to an ISBN-10.

See https://www.isbn-international.org/content/what-isbn for the format of ISBNs. See https://www.isbn-international.org/range_file_generation for the list of rules pertaining to each prefix/registration group.

_body() List[str]

Generate the information required to create an ISBN-10 or ISBN-13.

static _registrant_publication(reg_pub: str, rules: List[rules.RegistrantRule]) Tuple[str, str]

Separate the registration from the publication in a given string. :param reg_pub: A string of digits representing a registration

and publication.

Parameters

rules – A list of RegistrantRules which designate where to separate the values in the string.

Returns

A (registrant, publication) tuple of strings.

isbn13(separator: str = '-') str
isbn10(separator: str = '-') str
class faker.providers.isbn.en_US.Provider(generator: Any)

Bases: faker.providers.isbn.Provider

Generates fake ISBNs. ISBN rules vary across languages/regions so this class makes no attempt at replicating all of the rules. It only replicates the 978 EAN prefix for the English registration groups, meaning the first 4 digits of the ISBN-13 will either be 978-0 or 978-1. Since we are only replicating 978 prefixes, every ISBN-13 will have a direct mapping to an ISBN-10.

See https://www.isbn-international.org/content/what-isbn for the format of ISBNs. See https://www.isbn-international.org/range_file_generation for the list of rules pertaining to each prefix/registration group.