-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfasttag.py
More file actions
30 lines (27 loc) · 1.01 KB
/
Copy pathfasttag.py
File metadata and controls
30 lines (27 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import uuid
import qrcode
from datetime import datetime
class FastTag:
def _init_(self, vehicle_number, owner_name):
self.tag_id = str(uuid.uuid4())[:12].upper() # unique tag (12 chars)
self.vehicle_number = vehicle_number
self.owner_name = owner_name
self.issued_on = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
def generate_qr(self, filename="fastag.png"):
data = {
"FASTagID": self.tag_id,
"VehicleNumber": self.vehicle_number,
"Owner": self.owner_name,
"IssuedOn": self.issued_on
}
qr = qrcode.QRCode(version=1, box_size=10, border=5)
qr.add_data(str(data))
qr.make(fit=True)
img = qr.make_image(fill="black", back_color="white")
img.save(filename)
print(f"✅ FASTag QR generated: {filename}")
# Example usage
if _name_ == "_main_":
fastag = FastTag("KA05AB1234", "Vinay Gowda")
print("FASTag ID:", fastag.tag_id)
fastag.generate_qr("vinay_fastag.png")