persian-tools


Namepersian-tools JSON
Version 0.0.11 PyPI version JSON
download
home_pagehttps://github.com/persian-tools/py-persian-tools
SummaryAn anthology of a variety of tools for the Persian language in Python
upload_time2023-03-19 20:11:40
maintainer
docs_urlNone
authorAli Madihi (mrunderline)
requires_python>=3.6
licenseMIT
keywords digits commas iranian bank card number national id national code ordinal suffix
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Persian Tools

An anthology of a variety of tools for the Persian language in Python

[![codecov](https://codecov.io/gh/persian-tools/py-persian-tools/branch/master/graph/badge.svg?token=0M7JehkAWU)](https://codecov.io/gh/persian-tools/py-persian-tools)
![Tests](https://github.com/persian-tools/py-persian-tools/workflows/Test/badge.svg)

## Installation

`pip install persian-tools`

## Modules

1. [digits](#digits)
2. [separator](#separator)
3. [ordinal suffix](#ordinal-suffix)
4. [bank](#bank)
    1. [card number](#card-number)
    2. [sheba](#sheba)
5. [national id](#national-id)
6. [legal id](#legal-id)
7. [phone number](#phone-number)
8. [bill](#bill)
9. [plate](#plate)

## Usage
Let's take a look at what an example test case would look like using `persian-tools`.

### digits
This module will help you to normalize digits from Persian, Arabic and English to only one of them.

```python
from persian_tools import digits

digits.convert_to_fa(123)          # '۱۲۳'
digits.convert_to_fa('123')        # '۱۲۳'
digits.convert_to_fa('123٤٥٦')     # '۱۲۳۴۵۶'
digits.convert_to_fa('sth 123٤٥٦') # 'sth ۱۲۳۴۵۶'

digits.convert_to_en('۱۲۳')        # '123'
digits.convert_to_en('۱۲۳٤٥٦')     # '123456'
digits.convert_to_en('sth ۱۲۳٤٥٦') # 'sth 123456'

digits.convert_to_ar(123)          # '۱۲۳'
digits.convert_to_ar('123')        # '۱۲۳'
digits.convert_to_ar('sth 123۴۵۶') # 'sth ۱۲۳٤٥٦'
```

`persian-tools` also, has another function to convert numbers to words; you can convert result to ordinal mode with `ordinal=True` in inputs.
```python
from persian_tools import digits

digits.convert_to_word(500443)                  # پانصد هزار و چهارصد و چهل و سه
digits.convert_to_word(-500443)                 # منفی پانصد هزار و چهارصد و چهل و سه
digits.convert_to_word(500443, ordinal=True)    # پانصد هزار و چهارصد و چهل و سوم
digits.convert_to_word(30000000000)             # سی میلیارد
```

to convert words to number, you can use this function with different args:
```python
from persian_tools import digits

digits.convert_from_word('منفی سه هزارمین')                        # -3000
digits.convert_from_word('منفی سه هزارم', digits='fa')             # -۳۰۰۰
digits.convert_from_word('منفی سه هزار')                           # -3000
digits.convert_from_word('سه هزار دویست و دوازده')                 # 3212
digits.convert_from_word('دوازده هزار بیست دو', separator=True)    # '12,022'
digits.convert_from_word('حقوق شیش صد و ۲۷ میلیون تومان سالانه')    # 627000000
```

Note: as you can see in examples, this function will remove ordinal suffix by default.

### separator
Adding or removing thousands separators will handle; default separator is ',' but can change with second input.

```python
from persian_tools import separator

separator.add(300)                 # '300'
separator.add(3000000)             # '3,000,000'
separator.add(3000000.0003)        # '3,000,000.0003'
separator.add(3000000, '/')        # '3/000/000'
separator.add('۳۰۰۰۰')             # '۳۰,۰۰۰'

separator.remove('300')            # '300'
separator.remove('3,000,000')      # '3000000'
separator.remove('3/000/000', '/') # '3000000'
separator.remove('۳۰,۰۰۰')         # '۳۰۰۰۰'
```

### ordinal suffix
Adding or removing ordinal suffix for persian numbers in word will handle.

```python
from persian_tools import ordinal_suffix

ordinal_suffix.add('بیست')          # 'بیستم'
ordinal_suffix.add('سی و سه')       # 'سی و سوم'
ordinal_suffix.add('سی')            # 'سی اُم'

ordinal_suffix.remove('دومین')      # 'دو'
ordinal_suffix.remove('سی و سوم')   # 'سی و سه'
ordinal_suffix.remove('بیستم')      # 'بیست'
ordinal_suffix.remove('سی اُم')      # 'سی'
```

### bank
#### card number
This module has useful functions related to bank cards number, like:
* validating them
* find bank data of a card number
* extract card numbers from a text

```python
from persian_tools.bank import card_number

card_number.validate('6037701689095443')    # True
card_number.validate('6219861034529007')    # True
card_number.validate('6219861034529008')    # False

card_number.bank_data('6219861034529007')
# {'nickname': 'saman', 'name': 'Saman Bank', 'persian_name': 'بانک سامان', 'card_prefix': ['621986'], 'sheba_code': ['056']}
card_number.bank_data('6037701689095443')
# {'nickname': 'keshavarzi', 'name': 'Keshavarzi', 'persian_name': 'بانک کشاورزی', 'card_prefix': ['603770', '639217'], 'sheba_code': ['016']}



card_number.extract_card_numbers('''شماره کارتم رو برات نوشتم:
                                     6219-8610-3452-9007
                                     اینم یه شماره کارت دیگه ای که دارم
                                    ۵۰۲۲-۲۹۱۰-۷۰۸۷-۳۴۶۶                                     
                                    5022291070873466''',                # first argument is a text
                                    check_validation=True,              # a boolean that define you need only valid card numbers in result, default: True
                                    detect_bank_name=True,              # this will add bank name in result, default: False
                                    filter_valid_card_numbers=True)     # just valid card numbers will be in result; be careful to `check_validation` be also True, default: True
# result
# [
#    {'pure': '6219861034529007', 'base': '6219-8610-3452-9007', 'index': 1, 'is_valid': True,
#     'bank_data': {
#         'nickname': 'saman',
#         'name': 'Saman Bank',
#         'persian_name': 'بانک سامان',
#         'card_prefix': ['621986'],
#         'sheba_code': ['056'],
#     }},
#    {'pure': '5022291070873466', 'base': '5022291070873466', 'index': 3, 'is_valid': True,
#     'bank_data': {
#         'nickname': 'pasargad',
#         'name': 'Pasargad Bank',
#         'persian_name': 'بانک پاسارگاد',
#         'card_prefix': ['502229', '639347'],
#         'sheba_code': ['057'],
#     }},
# ]
```

#### sheba
`sheba` module contain 2 functions:
* validating them
* find bank data of a sheba number

```python

from persian_tools.bank import sheba

sheba.validate('IR820540102680020817909002')    # True
sheba.validate('IR01234567890123456789')        # False

sheba.bank_data('IR820540102680020817909002')
# {
#     'nickname': 'parsian',
#     'name': 'Parsian Bank',
#     'persian_name': 'بانک پارسیان',
#     'card_prefix': ['622106', '627884'],
#     'sheba_code': ['054'],
#     'account_number': '020817909002',
#     'formatted_account_number': '002-00817909-002'
# }
```

### national id
This module has useful functions related to iranian national id (code-e melli), like:
* validating them
* generate a random one
* find place of national id by the prefix of id

```python
from persian_tools import national_id

national_id.validate('0499370899')      # True
national_id.validate('0684159415')      # False

national_id.generate_random()           # '0458096784'
national_id.generate_random()           # '1156537101'

national_id.find_place('0906582709')    # {'code': ['089', '090'], 'city': 'کاشمر', 'province': 'خراسان رضوی'}
national_id.find_place('0643005846')    # {'code': ['064', '065'], 'city': 'بیرجند', 'province': 'خراسان جنوبی'}
```

### legal id
This module contains two functions to generate random iranian legal id (shenas-e melli) and validate any given id.

```python
from persian_tools import legal_id

legal_id.validate('10380284790')      # True
legal_id.validate('11053639140')      # False

legal_id.generate_random()            # '10100387143'
legal_id.generate_random()            # '77111986110'
```

### phone number
This module can validate, normalize and give you some data from a phone number.

```python
from persian_tools import phone_number

phone_number.validate('09123456789')        # True
phone_number.validate('+989123456789')      # True
phone_number.validate('989123456789')       # True
phone_number.validate('98912345678')        # False

phone_number.normalize('00989022002580')    # 09022002580
phone_number.normalize('+989022002580')     # 09022002580
phone_number.normalize('9022002580')        # 09022002580
phone_number.normalize('9022002580', '0')   # 09022002580
phone_number.normalize('9022002580', '+98') # 09022002580

phone_number.operator_data('09123456789')
# {'province': ['البرز', 'زنجان', 'سمنان', 'قزوین', 'قم', 'برخی از شهرستان های استان مرکزی'], 'base': 'تهران', 'type': ['permanent'], 'operator': 'همراه اول'}
phone_number.operator_data('09303456789')
# {'province': [], 'base': 'کشوری', 'type': ['permanent', 'credit'], 'operator': 'ایرانسل'}
```

### bill
With `bill_id` and `payment_id` (or just `barcode`), you can get detail of a `bill`.

```python
from persian_tools import bill

bill.get_detail(bill_id=7748317800142, payment_id=1770160)
# result
# {'amount': 1700,
#  'barcode': '77483178001420001770160',
#  'bill_id': 7748317800142,
#  'is_valid': True,
#  'is_valid_bill_id': True,
#  'is_valid_payment_id': True,
#  'payment_id': 1770160,
#  'type': 'تلفن ثابت'}

bill.get_detail(barcode='77483178001420001770160')
# same result

# default currency is set to Toman, but can change like as below
bill.get_detail(barcode='77483178001420001770160', currency=bill.CURRENCY_RIAL)
# result
# {'amount': 17000,
#  ...
```

### plate
Get information(province, category, type) about vehicles plate.

```python
from persian_tools import plate

plate.get_info('12D45147')
# result
# {'category': 'دیپلمات',
#   'province': 'مرکزی',
#   'template': '12D451ایران47',
#   'type': 'Car'}

plate.get_info('12345678')
# result
# {'category': None,
#  'province': 'مرکز تهران',
#  'template': '123-45678',
#  'type': 'Motorcycle'}

plate.is_valid('12D45147') # True
plate.is_valid('12345678') # True
plate.is_valid('1234567') # False
plate.is_valid('1204567') # False
```

Note: Plates that have farsi digits in them(like: الف، ب، ص) will be returned in this template:

`{first_two_digits}{plate_character}{next_three_digits}ایران{province_code}`

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/persian-tools/py-persian-tools",
    "name": "persian-tools",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "digits,commas,iranian bank,card number,national id,national code,ordinal suffix",
    "author": "Ali Madihi (mrunderline)",
    "author_email": "alimadihib@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d9/f2/3abbb645cbe778924807afefb95ae44051ad60eaadd6c614b7a1f0b46c1e/persian_tools-0.0.11.tar.gz",
    "platform": null,
    "description": "# Persian Tools\n\nAn anthology of a variety of tools for the Persian language in Python\n\n[![codecov](https://codecov.io/gh/persian-tools/py-persian-tools/branch/master/graph/badge.svg?token=0M7JehkAWU)](https://codecov.io/gh/persian-tools/py-persian-tools)\n![Tests](https://github.com/persian-tools/py-persian-tools/workflows/Test/badge.svg)\n\n## Installation\n\n`pip install persian-tools`\n\n## Modules\n\n1. [digits](#digits)\n2. [separator](#separator)\n3. [ordinal suffix](#ordinal-suffix)\n4. [bank](#bank)\n    1. [card number](#card-number)\n    2. [sheba](#sheba)\n5. [national id](#national-id)\n6. [legal id](#legal-id)\n7. [phone number](#phone-number)\n8. [bill](#bill)\n9. [plate](#plate)\n\n## Usage\nLet's take a look at what an example test case would look like using `persian-tools`.\n\n### digits\nThis module will help you to normalize digits from Persian, Arabic and English to only one of them.\n\n```python\nfrom persian_tools import digits\n\ndigits.convert_to_fa(123)          # '\u06f1\u06f2\u06f3'\ndigits.convert_to_fa('123')        # '\u06f1\u06f2\u06f3'\ndigits.convert_to_fa('123\u0664\u0665\u0666')     # '\u06f1\u06f2\u06f3\u06f4\u06f5\u06f6'\ndigits.convert_to_fa('sth 123\u0664\u0665\u0666') # 'sth \u06f1\u06f2\u06f3\u06f4\u06f5\u06f6'\n\ndigits.convert_to_en('\u06f1\u06f2\u06f3')        # '123'\ndigits.convert_to_en('\u06f1\u06f2\u06f3\u0664\u0665\u0666')     # '123456'\ndigits.convert_to_en('sth \u06f1\u06f2\u06f3\u0664\u0665\u0666') # 'sth 123456'\n\ndigits.convert_to_ar(123)          # '\u06f1\u06f2\u06f3'\ndigits.convert_to_ar('123')        # '\u06f1\u06f2\u06f3'\ndigits.convert_to_ar('sth 123\u06f4\u06f5\u06f6') # 'sth \u06f1\u06f2\u06f3\u0664\u0665\u0666'\n```\n\n`persian-tools` also, has another function to convert numbers to words; you can convert result to ordinal mode with `ordinal=True` in inputs.\n```python\nfrom persian_tools import digits\n\ndigits.convert_to_word(500443)                  # \u067e\u0627\u0646\u0635\u062f \u0647\u0632\u0627\u0631 \u0648 \u0686\u0647\u0627\u0631\u0635\u062f \u0648 \u0686\u0647\u0644 \u0648 \u0633\u0647\ndigits.convert_to_word(-500443)                 # \u0645\u0646\u0641\u06cc \u067e\u0627\u0646\u0635\u062f \u0647\u0632\u0627\u0631 \u0648 \u0686\u0647\u0627\u0631\u0635\u062f \u0648 \u0686\u0647\u0644 \u0648 \u0633\u0647\ndigits.convert_to_word(500443, ordinal=True)    # \u067e\u0627\u0646\u0635\u062f \u0647\u0632\u0627\u0631 \u0648 \u0686\u0647\u0627\u0631\u0635\u062f \u0648 \u0686\u0647\u0644 \u0648 \u0633\u0648\u0645\ndigits.convert_to_word(30000000000)             # \u0633\u06cc \u0645\u06cc\u0644\u06cc\u0627\u0631\u062f\n```\n\nto convert words to number, you can use this function with different args:\n```python\nfrom persian_tools import digits\n\ndigits.convert_from_word('\u0645\u0646\u0641\u06cc \u0633\u0647 \u0647\u0632\u0627\u0631\u0645\u06cc\u0646')                        # -3000\ndigits.convert_from_word('\u0645\u0646\u0641\u06cc \u0633\u0647 \u0647\u0632\u0627\u0631\u0645', digits='fa')             # -\u06f3\u06f0\u06f0\u06f0\ndigits.convert_from_word('\u0645\u0646\u0641\u06cc \u0633\u0647 \u0647\u0632\u0627\u0631')                           # -3000\ndigits.convert_from_word('\u0633\u0647 \u0647\u0632\u0627\u0631 \u062f\u0648\u06cc\u0633\u062a \u0648 \u062f\u0648\u0627\u0632\u062f\u0647')                 # 3212\ndigits.convert_from_word('\u062f\u0648\u0627\u0632\u062f\u0647 \u0647\u0632\u0627\u0631 \u0628\u06cc\u0633\u062a \u062f\u0648', separator=True)    # '12,022'\ndigits.convert_from_word('\u062d\u0642\u0648\u0642 \u0634\u06cc\u0634 \u0635\u062f \u0648 \u06f2\u06f7 \u0645\u06cc\u0644\u06cc\u0648\u0646 \u062a\u0648\u0645\u0627\u0646 \u0633\u0627\u0644\u0627\u0646\u0647')    # 627000000\n```\n\nNote: as you can see in examples, this function will remove ordinal suffix by default.\n\n### separator\nAdding or removing thousands separators will handle; default separator is ',' but can change with second input.\n\n```python\nfrom persian_tools import separator\n\nseparator.add(300)                 # '300'\nseparator.add(3000000)             # '3,000,000'\nseparator.add(3000000.0003)        # '3,000,000.0003'\nseparator.add(3000000, '/')        # '3/000/000'\nseparator.add('\u06f3\u06f0\u06f0\u06f0\u06f0')             # '\u06f3\u06f0,\u06f0\u06f0\u06f0'\n\nseparator.remove('300')            # '300'\nseparator.remove('3,000,000')      # '3000000'\nseparator.remove('3/000/000', '/') # '3000000'\nseparator.remove('\u06f3\u06f0,\u06f0\u06f0\u06f0')         # '\u06f3\u06f0\u06f0\u06f0\u06f0'\n```\n\n### ordinal suffix\nAdding or removing ordinal suffix for persian numbers in word will handle.\n\n```python\nfrom persian_tools import ordinal_suffix\n\nordinal_suffix.add('\u0628\u06cc\u0633\u062a')          # '\u0628\u06cc\u0633\u062a\u0645'\nordinal_suffix.add('\u0633\u06cc \u0648 \u0633\u0647')       # '\u0633\u06cc \u0648 \u0633\u0648\u0645'\nordinal_suffix.add('\u0633\u06cc')            # '\u0633\u06cc \u0627\u064f\u0645'\n\nordinal_suffix.remove('\u062f\u0648\u0645\u06cc\u0646')      # '\u062f\u0648'\nordinal_suffix.remove('\u0633\u06cc \u0648 \u0633\u0648\u0645')   # '\u0633\u06cc \u0648 \u0633\u0647'\nordinal_suffix.remove('\u0628\u06cc\u0633\u062a\u0645')      # '\u0628\u06cc\u0633\u062a'\nordinal_suffix.remove('\u0633\u06cc \u0627\u064f\u0645')      # '\u0633\u06cc'\n```\n\n### bank\n#### card number\nThis module has useful functions related to bank cards number, like:\n* validating them\n* find bank data of a card number\n* extract card numbers from a text\n\n```python\nfrom persian_tools.bank import card_number\n\ncard_number.validate('6037701689095443')    # True\ncard_number.validate('6219861034529007')    # True\ncard_number.validate('6219861034529008')    # False\n\ncard_number.bank_data('6219861034529007')\n# {'nickname': 'saman', 'name': 'Saman Bank', 'persian_name': '\u0628\u0627\u0646\u06a9 \u0633\u0627\u0645\u0627\u0646', 'card_prefix': ['621986'], 'sheba_code': ['056']}\ncard_number.bank_data('6037701689095443')\n# {'nickname': 'keshavarzi', 'name': 'Keshavarzi', 'persian_name': '\u0628\u0627\u0646\u06a9 \u06a9\u0634\u0627\u0648\u0631\u0632\u06cc', 'card_prefix': ['603770', '639217'], 'sheba_code': ['016']}\n\n\n\ncard_number.extract_card_numbers('''\u0634\u0645\u0627\u0631\u0647 \u06a9\u0627\u0631\u062a\u0645 \u0631\u0648 \u0628\u0631\u0627\u062a \u0646\u0648\u0634\u062a\u0645:\n                                     6219-8610-3452-9007\n                                     \u0627\u06cc\u0646\u0645 \u06cc\u0647 \u0634\u0645\u0627\u0631\u0647 \u06a9\u0627\u0631\u062a \u062f\u06cc\u06af\u0647 \u0627\u06cc \u06a9\u0647 \u062f\u0627\u0631\u0645\n                                    \u06f5\u06f0\u06f2\u06f2-\u06f2\u06f9\u06f1\u06f0-\u06f7\u06f0\u06f8\u06f7-\u06f3\u06f4\u06f6\u06f6                                     \n                                    5022291070873466''',                # first argument is a text\n                                    check_validation=True,              # a boolean that define you need only valid card numbers in result, default: True\n                                    detect_bank_name=True,              # this will add bank name in result, default: False\n                                    filter_valid_card_numbers=True)     # just valid card numbers will be in result; be careful to `check_validation` be also True, default: True\n# result\n# [\n#    {'pure': '6219861034529007', 'base': '6219-8610-3452-9007', 'index': 1, 'is_valid': True,\n#     'bank_data': {\n#         'nickname': 'saman',\n#         'name': 'Saman Bank',\n#         'persian_name': '\u0628\u0627\u0646\u06a9 \u0633\u0627\u0645\u0627\u0646',\n#         'card_prefix': ['621986'],\n#         'sheba_code': ['056'],\n#     }},\n#    {'pure': '5022291070873466', 'base': '5022291070873466', 'index': 3, 'is_valid': True,\n#     'bank_data': {\n#         'nickname': 'pasargad',\n#         'name': 'Pasargad Bank',\n#         'persian_name': '\u0628\u0627\u0646\u06a9 \u067e\u0627\u0633\u0627\u0631\u06af\u0627\u062f',\n#         'card_prefix': ['502229', '639347'],\n#         'sheba_code': ['057'],\n#     }},\n# ]\n```\n\n#### sheba\n`sheba` module contain 2 functions:\n* validating them\n* find bank data of a sheba number\n\n```python\n\nfrom persian_tools.bank import sheba\n\nsheba.validate('IR820540102680020817909002')    # True\nsheba.validate('IR01234567890123456789')        # False\n\nsheba.bank_data('IR820540102680020817909002')\n# {\n#     'nickname': 'parsian',\n#     'name': 'Parsian Bank',\n#     'persian_name': '\u0628\u0627\u0646\u06a9 \u067e\u0627\u0631\u0633\u06cc\u0627\u0646',\n#     'card_prefix': ['622106', '627884'],\n#     'sheba_code': ['054'],\n#     'account_number': '020817909002',\n#     'formatted_account_number': '002-00817909-002'\n# }\n```\n\n### national id\nThis module has useful functions related to iranian national id (code-e melli), like:\n* validating them\n* generate a random one\n* find place of national id by the prefix of id\n\n```python\nfrom persian_tools import national_id\n\nnational_id.validate('0499370899')      # True\nnational_id.validate('0684159415')      # False\n\nnational_id.generate_random()           # '0458096784'\nnational_id.generate_random()           # '1156537101'\n\nnational_id.find_place('0906582709')    # {'code': ['089', '090'], 'city': '\u06a9\u0627\u0634\u0645\u0631', 'province': '\u062e\u0631\u0627\u0633\u0627\u0646 \u0631\u0636\u0648\u06cc'}\nnational_id.find_place('0643005846')    # {'code': ['064', '065'], 'city': '\u0628\u06cc\u0631\u062c\u0646\u062f', 'province': '\u062e\u0631\u0627\u0633\u0627\u0646 \u062c\u0646\u0648\u0628\u06cc'}\n```\n\n### legal id\nThis module contains two functions to generate random iranian legal id (shenas-e melli) and validate any given id.\n\n```python\nfrom persian_tools import legal_id\n\nlegal_id.validate('10380284790')      # True\nlegal_id.validate('11053639140')      # False\n\nlegal_id.generate_random()            # '10100387143'\nlegal_id.generate_random()            # '77111986110'\n```\n\n### phone number\nThis module can validate, normalize and give you some data from a phone number.\n\n```python\nfrom persian_tools import phone_number\n\nphone_number.validate('09123456789')        # True\nphone_number.validate('+989123456789')      # True\nphone_number.validate('989123456789')       # True\nphone_number.validate('98912345678')        # False\n\nphone_number.normalize('00989022002580')    # 09022002580\nphone_number.normalize('+989022002580')     # 09022002580\nphone_number.normalize('9022002580')        # 09022002580\nphone_number.normalize('9022002580', '0')   # 09022002580\nphone_number.normalize('9022002580', '+98') # 09022002580\n\nphone_number.operator_data('09123456789')\n# {'province': ['\u0627\u0644\u0628\u0631\u0632', '\u0632\u0646\u062c\u0627\u0646', '\u0633\u0645\u0646\u0627\u0646', '\u0642\u0632\u0648\u06cc\u0646', '\u0642\u0645', '\u0628\u0631\u062e\u06cc \u0627\u0632 \u0634\u0647\u0631\u0633\u062a\u0627\u0646 \u0647\u0627\u06cc \u0627\u0633\u062a\u0627\u0646 \u0645\u0631\u06a9\u0632\u06cc'], 'base': '\u062a\u0647\u0631\u0627\u0646', 'type': ['permanent'], 'operator': '\u0647\u0645\u0631\u0627\u0647 \u0627\u0648\u0644'}\nphone_number.operator_data('09303456789')\n# {'province': [], 'base': '\u06a9\u0634\u0648\u0631\u06cc', 'type': ['permanent', 'credit'], 'operator': '\u0627\u06cc\u0631\u0627\u0646\u0633\u0644'}\n```\n\n### bill\nWith `bill_id` and `payment_id` (or just `barcode`), you can get detail of a `bill`.\n\n```python\nfrom persian_tools import bill\n\nbill.get_detail(bill_id=7748317800142, payment_id=1770160)\n# result\n# {'amount': 1700,\n#  'barcode': '77483178001420001770160',\n#  'bill_id': 7748317800142,\n#  'is_valid': True,\n#  'is_valid_bill_id': True,\n#  'is_valid_payment_id': True,\n#  'payment_id': 1770160,\n#  'type': '\u062a\u0644\u0641\u0646 \u062b\u0627\u0628\u062a'}\n\nbill.get_detail(barcode='77483178001420001770160')\n# same result\n\n# default currency is set to Toman, but can change like as below\nbill.get_detail(barcode='77483178001420001770160', currency=bill.CURRENCY_RIAL)\n# result\n# {'amount': 17000,\n#  ...\n```\n\n### plate\nGet information(province, category, type) about vehicles plate.\n\n```python\nfrom persian_tools import plate\n\nplate.get_info('12D45147')\n# result\n# {'category': '\u062f\u06cc\u067e\u0644\u0645\u0627\u062a',\n#   'province': '\u0645\u0631\u06a9\u0632\u06cc',\n#   'template': '12D451\u0627\u06cc\u0631\u0627\u064647',\n#   'type': 'Car'}\n\nplate.get_info('12345678')\n# result\n# {'category': None,\n#  'province': '\u0645\u0631\u06a9\u0632 \u062a\u0647\u0631\u0627\u0646',\n#  'template': '123-45678',\n#  'type': 'Motorcycle'}\n\nplate.is_valid('12D45147') # True\nplate.is_valid('12345678') # True\nplate.is_valid('1234567') # False\nplate.is_valid('1204567') # False\n```\n\nNote: Plates that have farsi digits in them(like: \u0627\u0644\u0641\u060c \u0628\u060c \u0635) will be returned in this template:\n\n`{first_two_digits}{plate_character}{next_three_digits}\u0627\u06cc\u0631\u0627\u0646{province_code}`\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An anthology of a variety of tools for the Persian language in Python",
    "version": "0.0.11",
    "split_keywords": [
        "digits",
        "commas",
        "iranian bank",
        "card number",
        "national id",
        "national code",
        "ordinal suffix"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ff11d63248ca31754d1593694dc1cabe869c5f92ed5266ff980bfdaadb92b6d8",
                "md5": "b940257f413ca9c73b43f9f9bec2d17a",
                "sha256": "13c2077e55990edf3ac70fbfa8efbaf4f5c242bcb487f219e974441e4ee1885c"
            },
            "downloads": -1,
            "filename": "persian_tools-0.0.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b940257f413ca9c73b43f9f9bec2d17a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 34723,
            "upload_time": "2023-03-19T20:11:38",
            "upload_time_iso_8601": "2023-03-19T20:11:38.320682Z",
            "url": "https://files.pythonhosted.org/packages/ff/11/d63248ca31754d1593694dc1cabe869c5f92ed5266ff980bfdaadb92b6d8/persian_tools-0.0.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d9f23abbb645cbe778924807afefb95ae44051ad60eaadd6c614b7a1f0b46c1e",
                "md5": "32ea7bb77f45e11ead83e5569c8d58cc",
                "sha256": "43995289687f1e686847333c77435a3e33722765b79ebfbf75155cf487bfb5c3"
            },
            "downloads": -1,
            "filename": "persian_tools-0.0.11.tar.gz",
            "has_sig": false,
            "md5_digest": "32ea7bb77f45e11ead83e5569c8d58cc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 30827,
            "upload_time": "2023-03-19T20:11:40",
            "upload_time_iso_8601": "2023-03-19T20:11:40.890114Z",
            "url": "https://files.pythonhosted.org/packages/d9/f2/3abbb645cbe778924807afefb95ae44051ad60eaadd6c614b7a1f0b46c1e/persian_tools-0.0.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-19 20:11:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "persian-tools",
    "github_project": "py-persian-tools",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "persian-tools"
}
        
Elapsed time: 0.05648s