Commit 9db48d23 authored by Matthew Pounsett's avatar Matthew Pounsett

PEP8 cleanup

parent 6ed107c8
......@@ -18,7 +18,6 @@
############################################################################
from collections import OrderedDict
from exceptions import TypeError
import time
import struct
import hashlib
......@@ -30,12 +29,14 @@ import socket
class rndc(object):
"""RNDC protocol client library"""
__algos = {'md5': 157,
'sha1': 161,
'sha224': 162,
'sha256': 163,
'sha384': 164,
'sha512': 165}
__algos = {
'md5': 157,
'sha1': 161,
'sha224': 162,
'sha256': 163,
'sha384': 164,
'sha512': 165
}
def __init__(self, host, algo, secret):
"""Creates a persistent connection to RNDC and logs in
......@@ -83,7 +84,7 @@ class rndc(object):
d['_ctrl'] = OrderedDict()
d['_ctrl']['_ser'] = str(self.ser)
d['_ctrl']['_tim'] = str(now)
d['_ctrl']['_exp'] = str(now+60)
d['_ctrl']['_exp'] = str(now + 60)
if self.nonce is not None:
d['_ctrl']['_nonce'] = self.nonce
d['_data'] = data
......@@ -147,13 +148,13 @@ class rndc(object):
pos = 0
labellen = ord(input[pos])
pos += 1
label = input[pos:pos+labellen]
label = input[pos:pos + labellen]
pos += labellen
type = ord(input[pos])
pos += 1
datalen = struct.unpack('>I', input[pos:pos+4])[0]
datalen = struct.unpack('>I', input[pos:pos + 4])[0]
pos += 4
data = input[pos:pos+datalen]
data = input[pos:pos + datalen]
pos += datalen
rest = input[pos:]
......@@ -171,7 +172,6 @@ class rndc(object):
def __parse_message(self, input):
rv = OrderedDict()
hdata = None
while len(input) > 0:
label, value, input = self.__parse_element(input)
rv[label] = value
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment