santiac89 / photon-packet-parser

A library to parse Photon Protocol16 packets in Python
MIT License
3 stars 4 forks source link

AttributeError: 'PhotonPacketParser' object has no attribute 'handle_payload'. Did you mean: 'HandlePayload'? #4

Open execeval opened 4 months ago

execeval commented 4 months ago

It seems that the library is not finished, and I really have trouble understanding how to make it work.

I tried this code. but payload is empty every time. I am parsing albion data and I got playload with wireshark copying hex data from UDP packet from "DATA" header

from photon_packet_parser import PhotonPacketParser

def on_event(header, payload):
    print(header, payload)

def on_request(header, payload):
    print(header, payload)

def on_response(header, payload):
    print(header, payload)

HEX_PAYLOAD = 'SECRET'
payload_data = bytes.fromhex(HEX_PAYLOAD )

parser = PhotonPacketParser(on_event, on_request, on_response)
parser.HandlePayload(payload_data)
execeval commented 4 months ago

Did a little bit of digging and all worked!

  1. handle_payload does not exist. Used HandlePayload() instead
  2. TypeError: on_request() missing 1 required positional argument: 'payload' Lines 93, 96, 99. Seems like payload is missing. Just added additional argument

Works for me now

Flockaboss commented 3 months ago

Do you have any success with parsing albion data by python you can share? I have same purpose