radio-code-calculator


Nameradio-code-calculator JSON
Version 1.1.3 PyPI version JSON
download
home_pagehttps://www.pelock.com/products/radio-code-calculator
SummaryRadio Code Calculator is an online service along with Web API and SDK for generating car radio unlock codes for popular vehicle brands.
upload_time2023-03-18 17:55:58
maintainer
docs_urlNone
authorBartosz Wójcik
requires_python
licenseApache-2.0
keywords radio code navigation calculator generator vehicle car automotive radiocode radiocodes api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Radio Code Calculator Online & SDK for Python

**[Radio Code Calculator](https://www.pelock.com/products/radio-code-calculator)** is an online service along with [Web API & SDK](https://www.pelock.com/products/radio-code-calculator/sdk) for generating car radio unlock codes for popular vehicle brands.

Following a breakdown or a disconnection of the car battery, most of the vehicle radio & navigation units will ask for an unlocking code. It's standard anti-theft protection.

Our car Radio Code Calculator allows you to generate **100% valid** radio codes to unlock car radios & navigation without the need to use the expensive service of authorized dealers.

![Radio Code Calculator](https://www.pelock.com/img/en/products/radio-code-calculator/car-radio-code-calculator-online-web-api-sdk.jpg)

The service is available through a simple online interface and `Web API`, with multiple `SDK` development libraries for popular programming languages.

Thanks to our solution, you can create, for instance, mobile or web applications that allow for easy generation of radio codes.

## Supported car models and radios

Our service is being continuously developed and new algorithms are gradually added for new car models and their radios.

If a new algorithm is added, you will get automatic and free access to it as part of your current license.

Individual calculators are available on our site as a paid service for end customers. You can verify them and see lists of supported radios on the relevant subpages:

* [Renault & Dacia](https://www.pelock.com/products/renault-and-dacia-car-radio-code-calculator-generator)
* [Toyota ERC](https://www.pelock.com/products/toyota-erc-calculator-radio-unlock-code-generator)
* [Jeep Cherokee](https://www.pelock.com/products/jeep-cherokee-radio-unlock-code-calculator-generator)
* [Ford M Serial](https://www.pelock.com/products/ford-radio-code-m-serial-calculator-generator)
* [Ford V Serial](https://www.pelock.com/products/ford-radio-code-v-serial-calculator-generator)
* [Ford TravelPilot EX, FX & NX](https://www.pelock.com/products/ford-travelpilot-ex-fx-nx-radio-code-generator-calculator)
* [Chrysler Panasonic TM9](https://www.pelock.com/products/chrysler-panasonic-tm9-car-radio-code-calculator-generator)
* [Fiat Stilo & Bravo Visteon](https://www.pelock.com/products/fiat-stilo-bravo-visteon-radio-code-calculator-generator)
* [Fiat DAIICHI MOPAR](https://www.pelock.com/products/fiat-daiichi-radio-code-calculator-generator)
* [Nissan Glove Box Immobiliser PIN](https://www.pelock.com/products/nissan-glove-box-pin-code-calculator)
* [Eclipse ESN Unlock Code Calculator](https://www.pelock.com/products/eclipse-esn-unlock-code-calculator)

## Use of radio code calculator

Where and who can use the radio code generation service and make money from code generation?

### ![Android](https://www.pelock.com/img/en/icons/android-32.png) App developers 
The main audience for our software is clearly developers and programmers, either of mobile or desktop applications.

### ![Shoping cart](https://www.pelock.com/img/en/icons/cart-32.png) Online stores 
If you run an online e-commerce store, you can sell radio codes through it using our software solutions.

### ![Car](https://www.pelock.com/img/en/icons/car-32.png) Auto repair shops
We also encourage car repair shops whose customers often use car radio unlocking services.

### ![Person](https://www.pelock.com/img/en/icons/user-32.png) Private individuals
Private individuals will also profit from our solution by generating codes and selling them on car forums or auction sites such as eBay, Craigslist.

### No limits!

You can generate codes **without limitation** with your purchased one year license.

Set your own price for generating a single code and start earning by using **tried and tested** algorithms from a programming language you know.

If you are not a programmer - don't worry. Just use our [online calculator](https://www.pelock.com/products/radio-code-calculator/online).

## Installation

The preferred way of Radio Code Calculator Web API interface installation is via [pip](https://pypi.org/project/pip/).

Run:

```
pip install radio-code-calculator
```

or 

```
python3 -m pip install radio-code-calculator
```

And then add this import to your source code:

```python
from radio_code_calculator import *
```

The installation package is available at https://pypi.org/project/radio-code-calculator/

## Packages for other programming languages

The installation packages have been uploaded to repositories for several popular programming languages and their source codes have been published on GitHub:

| Repository   | Language | Installation | Package | GitHub |
| ------------ | ---------| ------------ | ------- | ------ |
| ![Packagist repository for PHP and Composer](https://www.pelock.com/img/logos/repo-packagist-composer.png) | PHP | Add the following line to `require` section of your `composer.json` file `"pelock/radio-code-calculator": "*"` | [Packagist](https://packagist.org/packages/pelock/radio-code-calculator) | [Sources](https://github.com/PELock/Radio-Code-Calculator-PHP)
| ![PyPI repository for Python](https://www.pelock.com/img/logos/repo-pypi.png) | Python | Run `pip install radio-code-calculator` | [PyPi](https://pypi.org/project/radio-code-calculator/) | [Sources](https://github.com/PELock/Radio-Code-Calculator-Python)
| ![NPM repository for JavaScript and TypeScript](https://www.pelock.com/img/logos/repo-npm.png) | JavaScript, TypeScript | Run `npm i radio-code-calculator` or add the following to `dependencies` section of your `package.json` file `"dependencies": { "radio-code-calculator": "latest" },` | [NPM](https://www.npmjs.com/package/radio-code-calculator) | [Sources](https://github.com/PELock/Radio-Code-Calculator-JavaScript)

## Usage examples

### Radio code generation

This example demonstrates code generation for a selected radio model. All input parameter validation is done on the server side and if the radio serial number has an invalid length or pattern - the service will return an error.

```python
#!/usr/bin/env python

###############################################################################
#
# Radio Code Calculator API - WebApi interface usage example
#
# In this example, we will demonstrate how to generate a code for a specific
# type of car radio.
#
# Version        : v1.1.3
# Language       : Python
# Author         : Bartosz Wójcik
# Project        : https://www.pelock.com/products/radio-code-calculator
# Homepage       : https://www.pelock.com
#
###############################################################################

#
# include Radio Code Calculator API module
#
from radio_code_calculator import *

#
# create Radio Code Calculator API class instance (we are using our activation key)
#
myRadioCodeCalculator = RadioCodeCalculator("ABCD-ABCD-ABCD-ABCD")

#
# generate radio code (using Web API)
#
error, result = myRadioCodeCalculator.calc(RadioModels.FORD_M_SERIES, "123456")

if error == RadioErrors.SUCCESS:
    print(f'Radio code is {result["code"]}')
elif error == RadioErrors.INVALID_RADIO_MODEL:
    print("Invalid radio model (not supported)")
elif error == RadioErrors.INVALID_SERIAL_LENGTH:
    print(f'Invalid serial number length (expected {result["serialMaxLen"]} characters)')
elif error == RadioErrors.INVALID_SERIAL_PATTERN:
    print(f'Invalid serial number regular expression pattern (expected {result["serialRegexPattern"]["python"]} regex pattern)')
elif error == RadioErrors.INVALID_SERIAL_NOT_SUPPORTED:
    print("This serial number is not supported")
elif error == RadioErrors.INVALID_EXTRA_LENGTH:
    print(f'Invalid extra data length (expected {result["extraMaxLen"]} characters)')
elif error == RadioErrors.INVALID_EXTRA_PATTERN:
    print(f'Invalid extra data regular expression pattern (expected {result["extraRegexPattern"]["python"]} regex pattern)')
elif error == RadioErrors.INVALID_INPUT:
    print("Invalid input data")
elif error == RadioErrors.INVALID_COMMAND:
    print("Invalid command sent to the Web API interface")
elif error == RadioErrors.INVALID_LICENSE:
    print("Invalid license key")
elif error == RadioErrors.ERROR_CONNECTION:
    print("Something unexpected happen while trying to login to the service.")
else:
    print(f'Unknown error {error}')
```

### Radio code generation with additional offline validation

Radio codes are generated based on input parameters such as the **radio's serial number**, among others.

Radio serial numbers are different for different radios, they have different lengths and different patterns, some may consist of just digits e.g. `1234`, while others may consist of digits and letters e.g. `AB1234XYZ`.

Validation of this data is done on the server side. However, to make things more efficient, we can use the information about available limits and patterns of particular serial numbers to, for example, set these limits in controls in our own applications without unnecessary calls to the `Web API`.

```python
#!/usr/bin/env python

###############################################################################
#
# Radio Code Calculator API - WebApi interface usage example
#
# In this example, we will demonstrate how to generate a code for a specific
# type of car radio. This example shows how to use an extended offline
# validation.
#
# Version        : v1.1.3
# Language       : Python
# Author         : Bartosz Wójcik
# Project        : https://www.pelock.com/products/radio-code-calculator
# Homepage       : https://www.pelock.com
#
###############################################################################

#
# include Radio Code Calculator API module
#
from radio_code_calculator import *

#
# create Radio Code Calculator API class instance (we are using our activation key)
#
myRadioCodeCalculator = RadioCodeCalculator("ABCD-ABCD-ABCD-ABCD")

#
# generate a single radio unlocking code
#
serial: str = "123456"
extra: str = ""

#
# select a radio model
#
radioModel: RadioModel = RadioModels.FORD_M_SERIES

#
# display radio model information, you can use it to set limits in your controls e.g.
#
# textFieldRadioSerial.maxLength = radioModel.serial_max_len
# textFieldRadioSerial.regEx = radioModel.serial_regex_pattern
#
# (if allowed by your controls)
#
print(f'Radio model {radioModel.name} expects a serial number of {radioModel.serial_max_len}'
      f' length and {radioModel.serial_regex_pattern} regex pattern')

# additional information
if radioModel.extra_max_len > 0:
    print(f'Additionally an extra field is required with {radioModel.extra_max_len} and'
          f' and {radioModel.extra_regex_pattern} regex pattern')

#
# validate the serial number (offline) before sending the Web API request
#
error = radioModel.validate(serial, extra)

if error != RadioErrors.SUCCESS:

    if error == RadioErrors.INVALID_SERIAL_LENGTH:
        print(f'Invalid serial number length (expected {radioModel.serial_max_len} characters)')
    elif error == RadioErrors.INVALID_SERIAL_PATTERN:
        print(f'Invalid serial number regular expression pattern (expected {radioModel.serial_regex_pattern} regex pattern)')
    elif error == RadioErrors.INVALID_SERIAL_NOT_SUPPORTED:
        print("This serial number is not supported")
    elif error == RadioErrors.INVALID_EXTRA_LENGTH:
        print(f'Invalid extra data length (expected {radioModel.extra_max_len} characters)')
    elif error == RadioErrors.INVALID_EXTRA_PATTERN:
        print(f'Invalid extra data regular expression pattern (expected {radioModel.extra_regex_pattern} regex pattern)')
    exit(1)

#
# generate radio code (using Web API)
#
error, result = myRadioCodeCalculator.calc(radioModel, "123456")

if error == RadioErrors.SUCCESS:
    print(f'Radio code is {result["code"]}')
elif error == RadioErrors.INVALID_RADIO_MODEL:
    print("Invalid radio model (not supported)")
elif error == RadioErrors.INVALID_SERIAL_LENGTH:
    print(f'Invalid serial number length (expected {result["serialMaxLen"]} characters)')
elif error == RadioErrors.INVALID_SERIAL_PATTERN:
    print(f'Invalid serial number regular expression pattern (expected {result["serialRegexPattern"]["python"]} regex pattern)')
elif error == RadioErrors.INVALID_SERIAL_NOT_SUPPORTED:
    print("This serial number is not supported")
elif error == RadioErrors.INVALID_EXTRA_LENGTH:
    print(f'Invalid extra data length (expected {result["extraMaxLen"]} characters)')
elif error == RadioErrors.INVALID_EXTRA_PATTERN:
    print(f'Invalid extra data regular expression pattern (expected {result["extraRegexPattern"]["python"]} regex pattern)')
elif error == RadioErrors.INVALID_INPUT:
    print("Invalid input data")
elif error == RadioErrors.INVALID_COMMAND:
    print("Invalid command sent to the Web API interface")
elif error == RadioErrors.INVALID_LICENSE:
    print("Invalid license key")
elif error == RadioErrors.ERROR_CONNECTION:
    print("Something unexpected happen while trying to login to the service.")
else:
    print(f'Unknown error {error}')
```

### Download list of supported radio code calculators

If you would like to download information about all supported radio models and their parameters such as serial number length and pattern - you can do so.

```python
#!/usr/bin/env python

###############################################################################
#
# Radio Code Calculator API - WebApi interface usage example
#
# In this example we will list all the available calculators and, their
# parameters like name, maximum length of the radio serial number and its
# regex pattern.
#
# Version        : v1.1.3
# Language       : Python
# Author         : Bartosz Wójcik
# Project        : https://www.pelock.com/products/radio-code-calculator
# Homepage       : https://www.pelock.com
#
###############################################################################

#
# include Radio Code Calculator API module
#
from radio_code_calculator import *

#
# create Radio Code Calculator API class instance (we are using our activation key)
#
myRadioCodeCalculator = RadioCodeCalculator("ABCD-ABCD-ABCD-ABCD")

#
# get the list of the supported radio calculators and their parameters (max. length, regex pattern)
#
error, radio_models = myRadioCodeCalculator.list()

if error == RadioErrors.SUCCESS:

    print(f'Supported radio models {len(radio_models)}:\n')

    for radio_model in radio_models:

        print(f'Radio model name - {radio_model.name}')

        print(f'Max. length of the radio serial number - {radio_model.serial_max_len}')
        print(f'Regex pattern for the radio serial number - {radio_model.serial_regex_pattern}')

        # is extra field specified?
        if radio_model.extra_max_len > 0:
            print(f'Max. length of the radio extra data - {radio_model.extra_max_len}')
            print(f'Regex pattern for the radio extra data - {radio_model.extra_regex_pattern}')

        print()

elif error == RadioErrors.INVALID_LICENSE:
    print("Invalid activation key!")
else:
    print(f'Something unexpected happen while trying to login to the service (error code {error}).')
```

### Downloading the parameters of the selected radio calculator

You can download the parameters of the selected calculator.

```python
#!/usr/bin/env python

###############################################################################
#
# Radio Code Calculator API - WebApi interface usage example
#
# In this example, we will demonstrate how to get information about the
# specific radio calculator and its parameters (max. length & regex pattern).
#
# Version        : v1.1.3
# Language       : Python
# Author         : Bartosz Wójcik
# Project        : https://www.pelock.com/products/radio-code-calculator
# Homepage       : https://www.pelock.com
#
###############################################################################

#
# include Radio Code Calculator API module
#
from radio_code_calculator import *

#
# create Radio Code Calculator API class instance (we are using our activation key)
#
myRadioCodeCalculator = RadioCodeCalculator("ABCD-ABCD-ABCD-ABCD")

#
# query information about the radio model
#
error, radioModel = myRadioCodeCalculator.info("ford-m-series")

if error == RadioErrors.SUCCESS:

    print(f'Radio model name - {radioModel.name}')

    print(f'Max. length of the radio serial number - {radioModel.serial_max_len}')
    print(f'Regex pattern for the radio serial number - {radioModel.serial_regex_pattern}')

    # is extra field specified?
    if radioModel.extra_max_len > 0:
        print(f'Max. length of the radio extra data - {radioModel.extra_max_len}')
        print(f'Regex pattern for the radio extra data - {radioModel.extra_regex_pattern}')

    print()

elif error == RadioErrors.INVALID_LICENSE:
    print("Invalid license key!")
else:
    print(f'Something unexpected happen while trying to login to the service (error code {error}).')
```

### Checking activation key

By checking the activation key status, we will get information about the license owner, license type and license expiration date.

```python
#!/usr/bin/env python

###############################################################################
#
# Radio Code Calculator API - WebApi interface usage example
#
# In this example we will verify our activation key status.
#
# Version        : v1.1.3
# Language       : Python
# Author         : Bartosz Wójcik
# Project        : https://www.pelock.com/products/radio-code-calculator
# Homepage       : https://www.pelock.com
#
###############################################################################

#
# include Radio Code Calculator API module
#
from radio_code_calculator import *

#
# create Radio Code Calculator API class instance (we are using our activation key)
#
myRadioCodeCalculator = RadioCodeCalculator("ABCD-ABCD-ABCD-ABCD")

#
# login to the service
#
error, result = myRadioCodeCalculator.login()

#
# result[] array holds the information about the license
#
# result["license"]["activationStatus"] - True if license is active, False on invalid/expired keys
# result["license"]["userName"] - user name/company name of the license owner
# result["license"]["type"] - license type (0 - Personal License, 1 - Company License)
# result["license"]["expirationDate"] - license expiration date (in YYYY-MM-DD format)
#
if error == RadioErrors.SUCCESS:
    print(f'License activation status - {"True" if result["license"]["activationStatus"] else "False"}')
    print(f'License owner - {result["license"]["userName"]}')
    print(f'License type - {"Personal" if result["license"]["type"] == 0 else "Company"}')
    print(f'Expiration date - {result["license"]["expirationDate"]}')

elif error == RadioErrors.INVALID_LICENSE:
    print("Invalid license key!")
else:
    print(f'Something unexpected happen while trying to login to the service (error code {error}).')
```

## Got questions?

If you are interested in the Radio Code Calculator Web API or have any questions regarding radio code generator SDK packages, technical or legal issues, or if something is not clear, [please contact me](https://www.pelock.com/contact). I'll be happy to answer all of your questions.

Bartosz Wójcik

* Visit my site at — https://www.pelock.com
* Twitter — https://twitter.com/PELock
* GitHub — https://github.com/PELock


            

Raw data

            {
    "_id": null,
    "home_page": "https://www.pelock.com/products/radio-code-calculator",
    "name": "radio-code-calculator",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "radio code navigation calculator generator vehicle car automotive radiocode radiocodes api",
    "author": "Bartosz W\u00f3jcik",
    "author_email": "support@pelock.com",
    "download_url": "https://files.pythonhosted.org/packages/ae/b6/6ae126187893d592cd15c1fdd0bc185ff931914a8ac7e5b230493bb61965/radio_code_calculator-1.1.3.tar.gz",
    "platform": null,
    "description": "# Radio Code Calculator Online & SDK for Python\n\n**[Radio Code Calculator](https://www.pelock.com/products/radio-code-calculator)** is an online service along with [Web API & SDK](https://www.pelock.com/products/radio-code-calculator/sdk) for generating car radio unlock codes for popular vehicle brands.\n\nFollowing a breakdown or a disconnection of the car battery, most of the vehicle radio & navigation units will ask for an unlocking code. It's standard anti-theft protection.\n\nOur car Radio Code Calculator allows you to generate **100% valid** radio codes to unlock car radios & navigation without the need to use the expensive service of authorized dealers.\n\n![Radio Code Calculator](https://www.pelock.com/img/en/products/radio-code-calculator/car-radio-code-calculator-online-web-api-sdk.jpg)\n\nThe service is available through a simple online interface and `Web API`, with multiple `SDK` development libraries for popular programming languages.\n\nThanks to our solution, you can create, for instance, mobile or web applications that allow for easy generation of radio codes.\n\n## Supported car models and radios\n\nOur service is being continuously developed and new algorithms are gradually added for new car models and their radios.\n\nIf a new algorithm is added, you will get automatic and free access to it as part of your current license.\n\nIndividual calculators are available on our site as a paid service for end customers. You can verify them and see lists of supported radios on the relevant subpages:\n\n* [Renault & Dacia](https://www.pelock.com/products/renault-and-dacia-car-radio-code-calculator-generator)\n* [Toyota ERC](https://www.pelock.com/products/toyota-erc-calculator-radio-unlock-code-generator)\n* [Jeep Cherokee](https://www.pelock.com/products/jeep-cherokee-radio-unlock-code-calculator-generator)\n* [Ford M Serial](https://www.pelock.com/products/ford-radio-code-m-serial-calculator-generator)\n* [Ford V Serial](https://www.pelock.com/products/ford-radio-code-v-serial-calculator-generator)\n* [Ford TravelPilot EX, FX & NX](https://www.pelock.com/products/ford-travelpilot-ex-fx-nx-radio-code-generator-calculator)\n* [Chrysler Panasonic TM9](https://www.pelock.com/products/chrysler-panasonic-tm9-car-radio-code-calculator-generator)\n* [Fiat Stilo & Bravo Visteon](https://www.pelock.com/products/fiat-stilo-bravo-visteon-radio-code-calculator-generator)\n* [Fiat DAIICHI MOPAR](https://www.pelock.com/products/fiat-daiichi-radio-code-calculator-generator)\n* [Nissan Glove Box Immobiliser PIN](https://www.pelock.com/products/nissan-glove-box-pin-code-calculator)\n* [Eclipse ESN Unlock Code Calculator](https://www.pelock.com/products/eclipse-esn-unlock-code-calculator)\n\n## Use of radio code calculator\n\nWhere and who can use the radio code generation service and make money from code generation?\n\n### ![Android](https://www.pelock.com/img/en/icons/android-32.png) App developers \nThe main audience for our software is clearly developers and programmers, either of mobile or desktop applications.\n\n### ![Shoping cart](https://www.pelock.com/img/en/icons/cart-32.png) Online stores \nIf you run an online e-commerce store, you can sell radio codes through it using our software solutions.\n\n### ![Car](https://www.pelock.com/img/en/icons/car-32.png) Auto repair shops\nWe also encourage car repair shops whose customers often use car radio unlocking services.\n\n### ![Person](https://www.pelock.com/img/en/icons/user-32.png) Private individuals\nPrivate individuals will also profit from our solution by generating codes and selling them on car forums or auction sites such as eBay, Craigslist.\n\n### No limits!\n\nYou can generate codes **without limitation** with your purchased one year license.\n\nSet your own price for generating a single code and start earning by using **tried and tested** algorithms from a programming language you know.\n\nIf you are not a programmer - don't worry. Just use our [online calculator](https://www.pelock.com/products/radio-code-calculator/online).\n\n## Installation\n\nThe preferred way of Radio Code Calculator Web API interface installation is via [pip](https://pypi.org/project/pip/).\n\nRun:\n\n```\npip install radio-code-calculator\n```\n\nor \n\n```\npython3 -m pip install radio-code-calculator\n```\n\nAnd then add this import to your source code:\n\n```python\nfrom radio_code_calculator import *\n```\n\nThe installation package is available at https://pypi.org/project/radio-code-calculator/\n\n## Packages for other programming languages\n\nThe installation packages have been uploaded to repositories for several popular programming languages and their source codes have been published on GitHub:\n\n| Repository   | Language | Installation | Package | GitHub |\n| ------------ | ---------| ------------ | ------- | ------ |\n| ![Packagist repository for PHP and Composer](https://www.pelock.com/img/logos/repo-packagist-composer.png) | PHP | Add the following line to `require` section of your `composer.json` file `\"pelock/radio-code-calculator\": \"*\"` | [Packagist](https://packagist.org/packages/pelock/radio-code-calculator) | [Sources](https://github.com/PELock/Radio-Code-Calculator-PHP)\n| ![PyPI repository for Python](https://www.pelock.com/img/logos/repo-pypi.png) | Python | Run `pip install radio-code-calculator` | [PyPi](https://pypi.org/project/radio-code-calculator/) | [Sources](https://github.com/PELock/Radio-Code-Calculator-Python)\n| ![NPM repository for JavaScript and TypeScript](https://www.pelock.com/img/logos/repo-npm.png) | JavaScript, TypeScript | Run `npm i radio-code-calculator` or add the following to `dependencies` section of your `package.json` file `\"dependencies\": { \"radio-code-calculator\": \"latest\" },` | [NPM](https://www.npmjs.com/package/radio-code-calculator) | [Sources](https://github.com/PELock/Radio-Code-Calculator-JavaScript)\n\n## Usage examples\n\n### Radio code generation\n\nThis example demonstrates code generation for a selected radio model. All input parameter validation is done on the server side and if the radio serial number has an invalid length or pattern - the service will return an error.\n\n```python\n#!/usr/bin/env python\n\n###############################################################################\n#\n# Radio Code Calculator API - WebApi interface usage example\n#\n# In this example, we will demonstrate how to generate a code for a specific\n# type of car radio.\n#\n# Version        : v1.1.3\n# Language       : Python\n# Author         : Bartosz W\u00f3jcik\n# Project        : https://www.pelock.com/products/radio-code-calculator\n# Homepage       : https://www.pelock.com\n#\n###############################################################################\n\n#\n# include Radio Code Calculator API module\n#\nfrom radio_code_calculator import *\n\n#\n# create Radio Code Calculator API class instance (we are using our activation key)\n#\nmyRadioCodeCalculator = RadioCodeCalculator(\"ABCD-ABCD-ABCD-ABCD\")\n\n#\n# generate radio code (using Web API)\n#\nerror, result = myRadioCodeCalculator.calc(RadioModels.FORD_M_SERIES, \"123456\")\n\nif error == RadioErrors.SUCCESS:\n    print(f'Radio code is {result[\"code\"]}')\nelif error == RadioErrors.INVALID_RADIO_MODEL:\n    print(\"Invalid radio model (not supported)\")\nelif error == RadioErrors.INVALID_SERIAL_LENGTH:\n    print(f'Invalid serial number length (expected {result[\"serialMaxLen\"]} characters)')\nelif error == RadioErrors.INVALID_SERIAL_PATTERN:\n    print(f'Invalid serial number regular expression pattern (expected {result[\"serialRegexPattern\"][\"python\"]} regex pattern)')\nelif error == RadioErrors.INVALID_SERIAL_NOT_SUPPORTED:\n    print(\"This serial number is not supported\")\nelif error == RadioErrors.INVALID_EXTRA_LENGTH:\n    print(f'Invalid extra data length (expected {result[\"extraMaxLen\"]} characters)')\nelif error == RadioErrors.INVALID_EXTRA_PATTERN:\n    print(f'Invalid extra data regular expression pattern (expected {result[\"extraRegexPattern\"][\"python\"]} regex pattern)')\nelif error == RadioErrors.INVALID_INPUT:\n    print(\"Invalid input data\")\nelif error == RadioErrors.INVALID_COMMAND:\n    print(\"Invalid command sent to the Web API interface\")\nelif error == RadioErrors.INVALID_LICENSE:\n    print(\"Invalid license key\")\nelif error == RadioErrors.ERROR_CONNECTION:\n    print(\"Something unexpected happen while trying to login to the service.\")\nelse:\n    print(f'Unknown error {error}')\n```\n\n### Radio code generation with additional offline validation\n\nRadio codes are generated based on input parameters such as the **radio's serial number**, among others.\n\nRadio serial numbers are different for different radios, they have different lengths and different patterns, some may consist of just digits e.g. `1234`, while others may consist of digits and letters e.g. `AB1234XYZ`.\n\nValidation of this data is done on the server side. However, to make things more efficient, we can use the information about available limits and patterns of particular serial numbers to, for example, set these limits in controls in our own applications without unnecessary calls to the `Web API`.\n\n```python\n#!/usr/bin/env python\n\n###############################################################################\n#\n# Radio Code Calculator API - WebApi interface usage example\n#\n# In this example, we will demonstrate how to generate a code for a specific\n# type of car radio. This example shows how to use an extended offline\n# validation.\n#\n# Version        : v1.1.3\n# Language       : Python\n# Author         : Bartosz W\u00f3jcik\n# Project        : https://www.pelock.com/products/radio-code-calculator\n# Homepage       : https://www.pelock.com\n#\n###############################################################################\n\n#\n# include Radio Code Calculator API module\n#\nfrom radio_code_calculator import *\n\n#\n# create Radio Code Calculator API class instance (we are using our activation key)\n#\nmyRadioCodeCalculator = RadioCodeCalculator(\"ABCD-ABCD-ABCD-ABCD\")\n\n#\n# generate a single radio unlocking code\n#\nserial: str = \"123456\"\nextra: str = \"\"\n\n#\n# select a radio model\n#\nradioModel: RadioModel = RadioModels.FORD_M_SERIES\n\n#\n# display radio model information, you can use it to set limits in your controls e.g.\n#\n# textFieldRadioSerial.maxLength = radioModel.serial_max_len\n# textFieldRadioSerial.regEx = radioModel.serial_regex_pattern\n#\n# (if allowed by your controls)\n#\nprint(f'Radio model {radioModel.name} expects a serial number of {radioModel.serial_max_len}'\n      f' length and {radioModel.serial_regex_pattern} regex pattern')\n\n# additional information\nif radioModel.extra_max_len > 0:\n    print(f'Additionally an extra field is required with {radioModel.extra_max_len} and'\n          f' and {radioModel.extra_regex_pattern} regex pattern')\n\n#\n# validate the serial number (offline) before sending the Web API request\n#\nerror = radioModel.validate(serial, extra)\n\nif error != RadioErrors.SUCCESS:\n\n    if error == RadioErrors.INVALID_SERIAL_LENGTH:\n        print(f'Invalid serial number length (expected {radioModel.serial_max_len} characters)')\n    elif error == RadioErrors.INVALID_SERIAL_PATTERN:\n        print(f'Invalid serial number regular expression pattern (expected {radioModel.serial_regex_pattern} regex pattern)')\n    elif error == RadioErrors.INVALID_SERIAL_NOT_SUPPORTED:\n        print(\"This serial number is not supported\")\n    elif error == RadioErrors.INVALID_EXTRA_LENGTH:\n        print(f'Invalid extra data length (expected {radioModel.extra_max_len} characters)')\n    elif error == RadioErrors.INVALID_EXTRA_PATTERN:\n        print(f'Invalid extra data regular expression pattern (expected {radioModel.extra_regex_pattern} regex pattern)')\n    exit(1)\n\n#\n# generate radio code (using Web API)\n#\nerror, result = myRadioCodeCalculator.calc(radioModel, \"123456\")\n\nif error == RadioErrors.SUCCESS:\n    print(f'Radio code is {result[\"code\"]}')\nelif error == RadioErrors.INVALID_RADIO_MODEL:\n    print(\"Invalid radio model (not supported)\")\nelif error == RadioErrors.INVALID_SERIAL_LENGTH:\n    print(f'Invalid serial number length (expected {result[\"serialMaxLen\"]} characters)')\nelif error == RadioErrors.INVALID_SERIAL_PATTERN:\n    print(f'Invalid serial number regular expression pattern (expected {result[\"serialRegexPattern\"][\"python\"]} regex pattern)')\nelif error == RadioErrors.INVALID_SERIAL_NOT_SUPPORTED:\n    print(\"This serial number is not supported\")\nelif error == RadioErrors.INVALID_EXTRA_LENGTH:\n    print(f'Invalid extra data length (expected {result[\"extraMaxLen\"]} characters)')\nelif error == RadioErrors.INVALID_EXTRA_PATTERN:\n    print(f'Invalid extra data regular expression pattern (expected {result[\"extraRegexPattern\"][\"python\"]} regex pattern)')\nelif error == RadioErrors.INVALID_INPUT:\n    print(\"Invalid input data\")\nelif error == RadioErrors.INVALID_COMMAND:\n    print(\"Invalid command sent to the Web API interface\")\nelif error == RadioErrors.INVALID_LICENSE:\n    print(\"Invalid license key\")\nelif error == RadioErrors.ERROR_CONNECTION:\n    print(\"Something unexpected happen while trying to login to the service.\")\nelse:\n    print(f'Unknown error {error}')\n```\n\n### Download list of supported radio code calculators\n\nIf you would like to download information about all supported radio models and their parameters such as serial number length and pattern - you can do so.\n\n```python\n#!/usr/bin/env python\n\n###############################################################################\n#\n# Radio Code Calculator API - WebApi interface usage example\n#\n# In this example we will list all the available calculators and, their\n# parameters like name, maximum length of the radio serial number and its\n# regex pattern.\n#\n# Version        : v1.1.3\n# Language       : Python\n# Author         : Bartosz W\u00f3jcik\n# Project        : https://www.pelock.com/products/radio-code-calculator\n# Homepage       : https://www.pelock.com\n#\n###############################################################################\n\n#\n# include Radio Code Calculator API module\n#\nfrom radio_code_calculator import *\n\n#\n# create Radio Code Calculator API class instance (we are using our activation key)\n#\nmyRadioCodeCalculator = RadioCodeCalculator(\"ABCD-ABCD-ABCD-ABCD\")\n\n#\n# get the list of the supported radio calculators and their parameters (max. length, regex pattern)\n#\nerror, radio_models = myRadioCodeCalculator.list()\n\nif error == RadioErrors.SUCCESS:\n\n    print(f'Supported radio models {len(radio_models)}:\\n')\n\n    for radio_model in radio_models:\n\n        print(f'Radio model name - {radio_model.name}')\n\n        print(f'Max. length of the radio serial number - {radio_model.serial_max_len}')\n        print(f'Regex pattern for the radio serial number - {radio_model.serial_regex_pattern}')\n\n        # is extra field specified?\n        if radio_model.extra_max_len > 0:\n            print(f'Max. length of the radio extra data - {radio_model.extra_max_len}')\n            print(f'Regex pattern for the radio extra data - {radio_model.extra_regex_pattern}')\n\n        print()\n\nelif error == RadioErrors.INVALID_LICENSE:\n    print(\"Invalid activation key!\")\nelse:\n    print(f'Something unexpected happen while trying to login to the service (error code {error}).')\n```\n\n### Downloading the parameters of the selected radio calculator\n\nYou can download the parameters of the selected calculator.\n\n```python\n#!/usr/bin/env python\n\n###############################################################################\n#\n# Radio Code Calculator API - WebApi interface usage example\n#\n# In this example, we will demonstrate how to get information about the\n# specific radio calculator and its parameters (max. length & regex pattern).\n#\n# Version        : v1.1.3\n# Language       : Python\n# Author         : Bartosz W\u00f3jcik\n# Project        : https://www.pelock.com/products/radio-code-calculator\n# Homepage       : https://www.pelock.com\n#\n###############################################################################\n\n#\n# include Radio Code Calculator API module\n#\nfrom radio_code_calculator import *\n\n#\n# create Radio Code Calculator API class instance (we are using our activation key)\n#\nmyRadioCodeCalculator = RadioCodeCalculator(\"ABCD-ABCD-ABCD-ABCD\")\n\n#\n# query information about the radio model\n#\nerror, radioModel = myRadioCodeCalculator.info(\"ford-m-series\")\n\nif error == RadioErrors.SUCCESS:\n\n    print(f'Radio model name - {radioModel.name}')\n\n    print(f'Max. length of the radio serial number - {radioModel.serial_max_len}')\n    print(f'Regex pattern for the radio serial number - {radioModel.serial_regex_pattern}')\n\n    # is extra field specified?\n    if radioModel.extra_max_len > 0:\n        print(f'Max. length of the radio extra data - {radioModel.extra_max_len}')\n        print(f'Regex pattern for the radio extra data - {radioModel.extra_regex_pattern}')\n\n    print()\n\nelif error == RadioErrors.INVALID_LICENSE:\n    print(\"Invalid license key!\")\nelse:\n    print(f'Something unexpected happen while trying to login to the service (error code {error}).')\n```\n\n### Checking activation key\n\nBy checking the activation key status, we will get information about the license owner, license type and license expiration date.\n\n```python\n#!/usr/bin/env python\n\n###############################################################################\n#\n# Radio Code Calculator API - WebApi interface usage example\n#\n# In this example we will verify our activation key status.\n#\n# Version        : v1.1.3\n# Language       : Python\n# Author         : Bartosz W\u00f3jcik\n# Project        : https://www.pelock.com/products/radio-code-calculator\n# Homepage       : https://www.pelock.com\n#\n###############################################################################\n\n#\n# include Radio Code Calculator API module\n#\nfrom radio_code_calculator import *\n\n#\n# create Radio Code Calculator API class instance (we are using our activation key)\n#\nmyRadioCodeCalculator = RadioCodeCalculator(\"ABCD-ABCD-ABCD-ABCD\")\n\n#\n# login to the service\n#\nerror, result = myRadioCodeCalculator.login()\n\n#\n# result[] array holds the information about the license\n#\n# result[\"license\"][\"activationStatus\"] - True if license is active, False on invalid/expired keys\n# result[\"license\"][\"userName\"] - user name/company name of the license owner\n# result[\"license\"][\"type\"] - license type (0 - Personal License, 1 - Company License)\n# result[\"license\"][\"expirationDate\"] - license expiration date (in YYYY-MM-DD format)\n#\nif error == RadioErrors.SUCCESS:\n    print(f'License activation status - {\"True\" if result[\"license\"][\"activationStatus\"] else \"False\"}')\n    print(f'License owner - {result[\"license\"][\"userName\"]}')\n    print(f'License type - {\"Personal\" if result[\"license\"][\"type\"] == 0 else \"Company\"}')\n    print(f'Expiration date - {result[\"license\"][\"expirationDate\"]}')\n\nelif error == RadioErrors.INVALID_LICENSE:\n    print(\"Invalid license key!\")\nelse:\n    print(f'Something unexpected happen while trying to login to the service (error code {error}).')\n```\n\n## Got questions?\n\nIf you are interested in the Radio Code Calculator Web API or have any questions regarding radio code generator SDK packages, technical or legal issues, or if something is not clear, [please contact me](https://www.pelock.com/contact). I'll be happy to answer all of your questions.\n\nBartosz W\u00f3jcik\n\n* Visit my site at \u2014 https://www.pelock.com\n* Twitter \u2014 https://twitter.com/PELock\n* GitHub \u2014 https://github.com/PELock\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Radio Code Calculator is an online service along with Web API and SDK for generating car radio unlock codes for popular vehicle brands.",
    "version": "1.1.3",
    "split_keywords": [
        "radio",
        "code",
        "navigation",
        "calculator",
        "generator",
        "vehicle",
        "car",
        "automotive",
        "radiocode",
        "radiocodes",
        "api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e3e2f567726792075402a28e3943ea0c8de838b61da61e0d80403665412a0f3e",
                "md5": "44b129315be2970f9c026753d8855919",
                "sha256": "7c4423baea3ea5187e9d6e532f8328dd79000be39b21da94feca9142b69f4154"
            },
            "downloads": -1,
            "filename": "radio_code_calculator-1.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "44b129315be2970f9c026753d8855919",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 9407,
            "upload_time": "2023-03-18T17:55:56",
            "upload_time_iso_8601": "2023-03-18T17:55:56.597931Z",
            "url": "https://files.pythonhosted.org/packages/e3/e2/f567726792075402a28e3943ea0c8de838b61da61e0d80403665412a0f3e/radio_code_calculator-1.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "aeb66ae126187893d592cd15c1fdd0bc185ff931914a8ac7e5b230493bb61965",
                "md5": "643a86d0667bd22f7e596bfca78fe839",
                "sha256": "ed62041507eaf1d59dfd43dbf9aceb0e752856e1caa5bb8593fecaf94e30d6b4"
            },
            "downloads": -1,
            "filename": "radio_code_calculator-1.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "643a86d0667bd22f7e596bfca78fe839",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 13832,
            "upload_time": "2023-03-18T17:55:58",
            "upload_time_iso_8601": "2023-03-18T17:55:58.914282Z",
            "url": "https://files.pythonhosted.org/packages/ae/b6/6ae126187893d592cd15c1fdd0bc185ff931914a8ac7e5b230493bb61965/radio_code_calculator-1.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-18 17:55:58",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "radio-code-calculator"
}
        
Elapsed time: 0.04651s