Home > Uncategorized > Car Registration #API available on #Python #PIP

Car Registration #API available on #Python #PIP

installing-pip-on-centos-7

CarRegistration

This is an API Wrapper for Python for the VehicleRegistrationApi.com API which allows you to get car data from it’s number plate in many countries across the globe, from the USA, Europe, Australia, and Africa. Is is available as a package on PIP and easy_install  

An account username and password is required from VehicleRegistrationApi.com

When using the Generic “CarRegistration” function, the fourth parameter is an API endpoint, which can be one of;

  • Check (UK)
  • CheckBelgium
  • CheckCroatia
  • CheckCzechRepublic
  • CheckDenmark
  • CheckEstonia
  • CheckFinland
  • CheckFrance
  • CheckHungary
  • CheckIndia
  • CheckIreland
  • CheckItaly
  • CheckNetherlands
  • CheckNewZealand
  • CheckNigeria
  • CheckNorway
  • CheckPortugal
  • CheckRussia
  • CheckSlovakia
  • CheckSouthAfrica
  • CheckSpain
  • CheckSriLanka
  • CheckSweden
  • CheckUAE

For Australia and USA, you must also pass a state parameter, and therefore you must use the CarRegistrationUSA or CarRegistrationAustralia methods.

Installation

pip install CarRegistration

Usage (UK)

 from CarRegistration import *
 CarRegistration("BL64JTZ","***YOUR USERNAME***","***YOUR PASSWORD***","Check")

Usage (France)

 from CarRegistration import *
 CarRegistration("Eg258ma","***YOUR USERNAME***","***YOUR PASSWORD***","CheckFrance")

Usage (USA)

 from CarRegistration import *
 CarRegistrationUSA("H84jae","nj","***YOUR USERNAME***","***YOUR PASSWORD***")

Usage (Australia)

 from CarRegistration import *
 CarRegistrationAustralia("YHC14Y","NSW","***YOUR USERNAME***","***YOUR PASSWORD***")

Sample output

{u'RegistrationYear': u'2015', u'CarModel': {u'CurrentTextValue': u'208'}, u'NumberOfDoors': {u'CurrentTextValue': u'3'}, u'EngineSize': {u'CurrentTextValue': u'1397

And here’s the source code for those interested:

import urllib2, base64, json

def CarRegistration(registrationNumber, username, password):
request = urllib2.Request(“http://www.regcheck.org.uk/api/json.aspx/Check/” + registrationNumber)
base64string = base64.encodestring(‘%s:%s’ % (username, password)).replace(‘\n’, ”)
request.add_header(“Authorization”, “Basic %s” % base64string)
result = urllib2.urlopen(request)
data = json.load(result)
return(data)

Advertisement
Categories: Uncategorized
  1. June 16, 2019 at 10:06 am

    Here’s an example of using the API in australia, without PIP

    def CarRegistration(rego, state, username, password):
    request = urllib2.Request(“https://www.regcheck.org.uk/api/json.aspx/CheckAustralia/” + rego + “/” + state)
    base64string = base64.encodestring(‘%s:%s’ % (username, password)).replace(‘\n’, ”)
    request.add_header(“Authorization”, “Basic %s” % base64string)
    result = urllib2.urlopen(request)
    data = json.load(result)
    return(data)

    vehicle = CarRegistration(“ZM06WA”,”WA”,**USERNAME**”,”**PASSWORD**”);
    print(vehicle);

    Like

  2. June 17, 2019 at 9:16 am

    Here is similar code, but using python requests, instead of urllib2

    import requests
    import json
    from requests.auth import HTTPBasicAuth

    vehicle_reg_no = “….” <<<<<<< insert the correct registration number
    state = "….." <<<<<< Insert the state in which registered
    username = "……" <<<<<< insert your user name
    password = "…." <<<<<< insert your password

    url = "https://www.regcheck.org.uk/api/json.aspx/CheckAustralia/&quot;
    url = url + "%s/%s" % (vehicle_reg_no.replace(" ", ""), state.replace(" ", ""))
    r = requests.get(url, auth=HTTPBasicAuth(username, password))
    if r.status_code == requests.codes['ok']:
    result = r.json()

    Like

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: