A memory leak has been fixed. After an http connection is open it is never closed. The loop method has been modified to close the connection upon completion.
There have been several other changes, all of which are in accordance with standard practice in the Python community:
- spaces instead of tabs
- improved whitespace
- correctly ordered import statements.
printfunctions instead of statements.- string
formatmethod instead of deprecated%syntax setdefaultmethod for setting dictionary defaults- among many other minor changes.
Notes:
- These changes have made it easier to understand and modify the codebase.
- This code did not have tests; incorporating tests would require a more significant refactor. Due to the nature of my intended changes, I decided it was not necessary at this point to refactor to that extent.
- This code did not have docstrings (See PEP 257: http://legacy.python.org/dev/peps/pep-0257/). In order to successfully refactor and test this in the future docstrings will prove helpful.