summaryrefslogtreecommitdiffstats
path: root/src/restRequest.py
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2020-02-26 10:40:20 +0100
committerAlvaro Neira Ayuso <aneira@soleta.eu>2020-03-09 18:10:49 +0100
commita6d3b7915c56b89fc2bdaca159f81870d3546e95 (patch)
treee87988e6df2547e51d26662cad2e0c1e4219305e /src/restRequest.py
parent4e1ad0f949bda71a4c490b2df577a4db88911ca0 (diff)
use lowercase attribute name in restRequest
Diffstat (limited to 'src/restRequest.py')
-rw-r--r--src/restRequest.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/restRequest.py b/src/restRequest.py
index b0baa15..59c6aca 100644
--- a/src/restRequest.py
+++ b/src/restRequest.py
@@ -12,12 +12,12 @@ import json
class restRequest:
def __init__(self):
- self.requestLine = None
- self.headersAlone = None
+ self.request_line = None
+ self.headers_alone = None
self.headers = None
self.host = None
- self.contentType = None
- self.contentLen = None
+ self.content_type = None
+ self.content_len = None
self.operation = None
self.URI = None
self.run = None
@@ -35,24 +35,24 @@ class restRequest:
self.code = None
def parser(self,data):
- self.requestLine, self.headersAlone = data.split('\n', 1)
- self.headers = email.message_from_file(StringIO(self.headersAlone))
+ self.request_line, self.headers_alone = data.split('\n', 1)
+ self.headers = email.message_from_file(StringIO(self.headers_alone))
if 'Host' in self.headers.keys():
self.host = self.headers['Host']
if 'Content-Type' in self.headers.keys():
- self.contentType = self.headers['Content-Type']
+ self.content_type = self.headers['Content-Type']
if 'Content-Length' in self.headers.keys():
- self.contentLen = int(self.headers['Content-Length'])
+ self.content_len = int(self.headers['Content-Length'])
- if (not self.requestLine == None or not self.requestLine == ''):
- self.method = self.requestLine.split('/', 1)[0]
- self.URI = self.requestLine.split('/', 1)[1]
+ if (not self.request_line == None or not self.request_line == ''):
+ self.method = self.request_line.split('/', 1)[0]
+ self.URI = self.request_line.split('/', 1)[1]
- if not self.contentLen == 0:
- msgs = self.headersAlone.rstrip().split('\n')
+ if not self.content_len == 0:
+ msgs = self.headers_alone.rstrip().split('\n')
body = msgs[len(msgs) - 1]
try:
json_param = json.loads(body)