softScheck / tplink-smartplug

TP-Link WiFi SmartPlug Client and Wireshark Dissector
Apache License 2.0
1.14k stars 296 forks source link

Refactored for native python3 support (maintain python2 support with version detection) #67

Closed AMDHome closed 4 years ago

AMDHome commented 4 years ago

The same script can now be run on Python 2 and Python 3

Main issues between Python 2.x and Python 3.x on this script are the handling of bytes/strings and the print statements.

Changes made:

There are no changes to the functionality of the script. You can run it with exactly the same arguments as you could before. Should be more or less a drop in replacement for everyone as long as the print statement formatting doesn't screw things up for you. It also allows for people to use this script with Python 3 in the future.

If you don't like the giant if statement you can choose which functions you want depending on the version you are using and delete the other one in your own projects. First set of encode/decode is for python3 the second set is for python 2

softScheck commented 4 years ago

Thanks for your commit. Looks good.