Skip to content

Instantly share code, notes, and snippets.

@nikhilweee
Last active May 12, 2026 22:37
Show Gist options
  • Select an option

  • Save nikhilweee/9efd9731880104dd00ecf2ed8effacc5 to your computer and use it in GitHub Desktop.

Select an option

Save nikhilweee/9efd9731880104dd00ecf2ed8effacc5 to your computer and use it in GitHub Desktop.
Get vehicle info from an Indian registration number
import sys
import requests
from bs4 import BeautifulSoup, SoupStrainer
home_url = 'https://parivahan.gov.in/rcdlstatus/'
post_url = 'https://parivahan.gov.in/rcdlstatus/vahan/rcDlHome.xhtml'
# Everything before the last four digits: MH02CL
first = sys.argv[1]
# The last four digits: 0555
second = sys.argv[2]
r = requests.get(url=home_url)
cookies = r.cookies
soup = BeautifulSoup(r.text, 'html.parser')
viewstate = soup.select('input[name="javax.faces.ViewState"]')[0]['value']
data = {
'javax.faces.partial.ajax':'true',
'javax.faces.source': 'form_rcdl:j_idt32',
'javax.faces.partial.execute':'@all',
'javax.faces.partial.render': 'form_rcdl:pnl_show form_rcdl:pg_show form_rcdl:rcdl_pnl',
'form_rcdl:j_idt32':'form_rcdl:j_idt32',
'form_rcdl':'form_rcdl',
'form_rcdl:tf_reg_no1': first,
'form_rcdl:tf_reg_no2': second,
'javax.faces.ViewState': viewstate,
}
r = requests.post(url=post_url, data=data, cookies=cookies)
soup = BeautifulSoup(r.text, 'html.parser')
table = SoupStrainer('tr')
soup = BeautifulSoup(soup.get_text(), 'html.parser', parse_only=table)
print(soup.get_text())

Programmatically extract owner info from Indian registration numbers

Usage

$ python registration_info.py MH02CL 0555
Registration No:
MH02CL0555
Registration Date:
20-Jan-2012

Chasi No:
WBAKB42080CY83879
Engine No:
16257849

Owner Name: 
SHAH RUKH KHAN

Vehicle Class: 
LMVIMP
Fuel Type:
PETROL

Maker Model:
BMW INDIA PVT. LTD., BMW 740 L I PETROL

Requirements

requests
beautifulsoup4
@sricsccenter
Copy link
Copy Markdown

Can someone confirm that the java code is working? I tried but it is not working for me.

Hi,

I tried and its working for me. Here is my version based on the source code provided by https://gist.github.com/githubsrinath/560e2382cb3f84e421f8cf14e5e912b0#file-03-java-or-android

https://github.com/ckenny/IndianVehicleNumberChecker/blob/master/VehicleNumberChecker.java

~KC

Brother do you find any Source to Get Data For Free Please Tell me.

@Rahulgithubrit
Copy link
Copy Markdown

it still does not work

@ashish-budhraja
Copy link
Copy Markdown

You can Check once for www.apiclub.in

ApiClub is asking for 10K just for account activation which is non refundable

This amount is added as credits into your wallet for consumption of the APIs.

@umranjammu
Copy link
Copy Markdown

Privahan Sewa offers a variety of services, including online services, Sarathi Parivahan driving license services, Vahan parivahan vehicle registration permits, Check post tax payments, RTO registration, learner’s license services throughout India. Its purpose is to enhance convenience, save time, and ensure transparency in the often intricate realm of vehicle management

@parivahansewaportal
Copy link
Copy Markdown

The Parivahan Sewa was launched by the Ministry of Road Transport and Highways (MoRTH), Government of India. It was developed as part of the e-Governance initiative to provide online services related to road transport across India. The platform was designed to digitize various transport-related services, improve transparency, and reduce the need for citizens to physically visit Regional Transport Offices (RTOs).Online transport servicesVehicle fitness certificate

@ashish-budhraja
Copy link
Copy Markdown

No government portal flood with ads on their website 😅

The Parivahan Sewa was launched by the Ministry of Road Transport and Highways (MoRTH), Government of India. It was developed as part of the e-Governance initiative to provide online services related to road transport across India. The platform was designed to digitize various transport-related services, improve transparency, and reduce the need for citizens to physically visit Regional Transport Offices (RTOs).Online transport servicesVehicle fitness certificate

@parivahansewaportal
Copy link
Copy Markdown

The  Parivahan Sewa portal is a key digital initiative from the Ministry of Road Transport and Highways (MoRTH). Its goal is to make a wide range of transport-related services modern, easy to access, and transparent for everyone in India. This comprehensive online platform helps you avoid frequent trips to the Regional Transport Office (RTO) for essential tasks.

@rajap-web
Copy link
Copy Markdown

Any one find the Correct source. Please help me to find the Source. Anyone Have Source Code to Scrap Data.
Please Share Me

@Sardheesh-9230
Copy link
Copy Markdown

IT IS NOT WORKING IT OCCURS INTERNAL SERVER ERROR

@trishantpahwa
Copy link
Copy Markdown

@Sardheesh-9230 @rajap-web @sricsccenter @dhanish-jose you can register here. This platform provides a high uptime and correct vehicle details.

@Sarthak2011-dev
Copy link
Copy Markdown

not showing any error but at the same time no output is getting printed.....Please help me with this Screenshot from 2020-12-12 18-43-02 brother there is python library problem

@JimmyMalikF
Copy link
Copy Markdown

Interesting project. I noticed many older Parivahan scraping methods and unofficial APIs are no longer stable because of captcha and endpoint changes.

For anyone looking for transport-related portals and updates, I recently came across LTO Portal which shares guides and online vehicle/traffic service resources in a simpler format. Might be useful as an additional reference alongside these APIs and scraping discussions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment