From a84c41a572a3754183c37483333856837fcdeb23 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Fri, 6 Aug 2021 15:56:08 +0200 Subject: [PATCH] Move samples to readme --- README.md | 3 +-- insee_number_translator/main.py | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 710470f..4cab59a 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,7 @@ Extract data from INSEE number (France) pyenv virtualenv 3.9.6 insee pyenv local insee poetry install -python insee_number_translator/main.py -python insee_number_translator/main.py 123456789123456 +insee 269059913116714 168127982980507 ``` ## Data sources diff --git a/insee_number_translator/main.py b/insee_number_translator/main.py index e1c49f1..9f80214 100644 --- a/insee_number_translator/main.py +++ b/insee_number_translator/main.py @@ -152,14 +152,15 @@ class InseeData: def main(): - numbers = ["269059913116714", "168127982980507"] if len(sys.argv) > 1: numbers = sys.argv[1:] + else: + print(f"Usage: {sys.argv[0]} insee_number_1 [insee_number_2 ...]") + sys.exit(1) for number in numbers: data = InseeData(number) print(data) pprint.pprint(data.to_dict()) - print("\n\n") if __name__ == "__main__":