/pcars2

Python client for Project CARS 2 UDP data stream.

Primary LanguagePython

Build Status Coverage Status


This is a fork of a pcars Python client for the Project CARS 2 UDP data stream. Library was adapted to work with V2 version of stream.

Installation

# Clone repository
$ git clone https://github.com/jkowa/pcars2.git
# Go to repository
$ cd pcars2
# Install with pip
$ pip install .

Quickstart

from pcars.stream import PCarsStreamReceiver

class MyPCarsListener(object):
    def handlePacket(self, data):
        # You probably want to do something more exciting here
        # You probably also want to switch on data.packetType
        # See listings in packet.py for packet types and available fields for each
        print data


listener = MyPCarsListener()
stream = PCarsStreamReceiver()
stream.addListener(listener)
stream.start()