two package network fucntion uncompleted"

This commit is contained in:
2019-12-15 12:30:06 +08:00
parent dfd5369114
commit 5578131df7
4 changed files with 29 additions and 20 deletions

18
mswp.py
View File

@@ -1,3 +1,6 @@
from config import jsondata
class Datapack:
def __init__(self, method='post', app='all', version='msw/1.0', head={}, body=b'', check_head=True):
self.method = method
@@ -30,17 +33,8 @@ class Datapack:
i, ii = line.split(': ')
self.head[i] = ii
def is_enough(self):
body_length = len(self.body)
head_length = int(self.head['length'])
if head_length == body_length:
return True
elif head_length > body_length:
return False
else:
print("Error: length is larger than the body")
raise IOError
def split_dp_data(data):
pass
def is_complete(self):
pass # here needs to add more function