# vin-parser
Library that provides functions to work with VIN strings.
## Install
vin-parser is available on PyPI and can be installed using pip.
`$ pip install vin-parser`
## Usage
All the public functions are exported to the package namespace. We'll alias it as vp in the following examples.
`>>> import vin_parser as vp`
<!--
Example usage with some fakey VINS.
Show wmi, vds for lowercase VINS
-->
The functions `check_no`, `seq_no`, `wmi`, `vds` and `vis` return parts of the VIN string.
```python3
>>> vin = "1GYFK63878R248711"
>>> vp.check_no(vin)
'7'
```
Function `check_no` returns the VIN check digit, i.e. position 9 in the VIN string. It returns for all VINs, even for those that don't use the check digit schema.
```python3
>>> vp.wmi(vin)
'1GY'
>>> vp.vds(vin)
'FK6387'
```
Lowercase VINs are accepted:
```python3
>>> vp.vis(vin.lower())
'8R248711'
```
`check_valid`, `is_valid` and `small_manuf` are predicate functions, i.e. functions that return True or False.
`check_valid` returns True if the VIN's check digit matches the computed value.
`is_valid` returns True if the provided VIN is valid. Because the use of VIN check digit is not adopted worldwide, the check_valid test is not performed when verifing the validity of a VIN.
Functions `continent`, `country`, `year` and `manuf` parse the VIN and return the values. year returns a positive integer, while the others return a string with their name.
```python3
>>> vp.country(vin)
'United States'
>>> vp.year(vin)
2008
>>> vp.manuf(vin)
'General Motors USA'
```
Function `parse` calls all the other functions and returns the results in a dict if the provided VIN is valid.
Function `online_parse` queries the nhtsa api with the provided VIN. Empty values are removed from the response and the rest are returned in a python dict. No other transformations are performed on the keys or values.
Note that, unlike `parse`, `online_parse` doesn't check if the VIN is valid before sending it to the remote server.
The `CHARS` constant is a sorted string with all the valid characters of a VIN: A to Z, 1 to 9 and 0, except for I, O and Q.
Raw data
{
"_id": null,
"home_page": "https://github.com/nighcoder/vin-parser",
"name": "vin-parser",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "VIN,WMI,VDS,OBD",
"author": "Daniel Ciumberic\u0103",
"author_email": "ciumbi.ionut@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/79/ac/10f1ecddcff819f8f2d8260d4b18243aa09eb30e2f3e63a474ae894ba85d/vin-parser-0.0.1.tar.gz",
"platform": "",
"description": "# vin-parser\nLibrary that provides functions to work with VIN strings.\n\n## Install\nvin-parser is available on PyPI and can be installed using pip.\n\n`$ pip install vin-parser`\n\n## Usage\nAll the public functions are exported to the package namespace. We'll alias it as vp in the following examples.\n\n`>>> import vin_parser as vp`\n<!--\nExample usage with some fakey VINS.\nShow wmi, vds for lowercase VINS\n-->\n\nThe functions `check_no`, `seq_no`, `wmi`, `vds` and `vis` return parts of the VIN string.\n```python3\n>>> vin = \"1GYFK63878R248711\"\n>>> vp.check_no(vin)\n'7'\n```\nFunction `check_no` returns the VIN check digit, i.e. position 9 in the VIN string. It returns for all VINs, even for those that don't use the check digit schema.\n\n```python3\n>>> vp.wmi(vin)\n'1GY'\n>>> vp.vds(vin)\n'FK6387'\n```\nLowercase VINs are accepted:\n```python3\n>>> vp.vis(vin.lower())\n'8R248711'\n```\n\n`check_valid`, `is_valid` and `small_manuf` are predicate functions, i.e. functions that return True or False.\n`check_valid` returns True if the VIN's check digit matches the computed value.\n`is_valid` returns True if the provided VIN is valid. Because the use of VIN check digit is not adopted worldwide, the check_valid test is not performed when verifing the validity of a VIN.\n\nFunctions `continent`, `country`, `year` and `manuf` parse the VIN and return the values. year returns a positive integer, while the others return a string with their name.\n```python3\n>>> vp.country(vin)\n'United States'\n>>> vp.year(vin)\n2008\n>>> vp.manuf(vin)\n'General Motors USA'\n```\n\nFunction `parse` calls all the other functions and returns the results in a dict if the provided VIN is valid.\nFunction `online_parse` queries the nhtsa api with the provided VIN. Empty values are removed from the response and the rest are returned in a python dict. No other transformations are performed on the keys or values.\nNote that, unlike `parse`, `online_parse` doesn't check if the VIN is valid before sending it to the remote server.\n\nThe `CHARS` constant is a sorted string with all the valid characters of a VIN: A to Z, 1 to 9 and 0, except for I, O and Q.\n\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "This is vin-parser package description",
"version": "0.0.1",
"project_urls": {
"Homepage": "https://github.com/nighcoder/vin-parser"
},
"split_keywords": [
"vin",
"wmi",
"vds",
"obd"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e540b15e3efe13279a6cc4607ed31f7564e7b094313f464769a2619c18aa80e3",
"md5": "486f0bd1cf863618727cac0f0fe558ac",
"sha256": "ce45ce0de447e5a1edb3400766dfde0816513ddca08e48c41b305e2669cc88d1"
},
"downloads": -1,
"filename": "vin_parser-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "486f0bd1cf863618727cac0f0fe558ac",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 11409,
"upload_time": "2019-12-09T08:16:32",
"upload_time_iso_8601": "2019-12-09T08:16:32.850165Z",
"url": "https://files.pythonhosted.org/packages/e5/40/b15e3efe13279a6cc4607ed31f7564e7b094313f464769a2619c18aa80e3/vin_parser-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "79ac10f1ecddcff819f8f2d8260d4b18243aa09eb30e2f3e63a474ae894ba85d",
"md5": "8b6ee3aaba25d23666c78e557a22d750",
"sha256": "a6a2f783d1db8328abc22e71c75462f74a86c30fb0df41478ce5bb79149c1938"
},
"downloads": -1,
"filename": "vin-parser-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "8b6ee3aaba25d23666c78e557a22d750",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10954,
"upload_time": "2019-12-09T08:16:35",
"upload_time_iso_8601": "2019-12-09T08:16:35.286032Z",
"url": "https://files.pythonhosted.org/packages/79/ac/10f1ecddcff819f8f2d8260d4b18243aa09eb30e2f3e63a474ae894ba85d/vin-parser-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2019-12-09 08:16:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nighcoder",
"github_project": "vin-parser",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "vin-parser"
}