Skip to content

Commit

Permalink
Fixed error with headers
Browse files Browse the repository at this point in the history
  • Loading branch information
jona799t committed May 25, 2022
1 parent 5987a08 commit e3ff729
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions requestsWS/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
connectionsKept = []

class get:
def __init__(self, wsUrl, headers=None, encryption=None, identifiers=None, timeout=None, debug=False):
def __init__(self, wsUrl, headers={}, encryption=None, identifiers=None, timeout=None, debug=False):
global ws
if wsUrl != wsData["CURRENT_URL"]:
wsData["CURRENT_URL"] = wsUrl
Expand Down Expand Up @@ -58,7 +58,7 @@ def json(self):
return JSON.loads(self.text)

class post:
def __init__(self, wsUrl, headers=None, encryption=None, data=None, json=None, identifiers=None, waitForResponse=True, timeout=None, debug=False):
def __init__(self, wsUrl, headers={}, encryption=None, data=None, json=None, identifiers=None, waitForResponse=True, timeout=None, debug=False):
global ws

if data == None and json == None:
Expand Down
8 changes: 4 additions & 4 deletions requestsWS/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def json(self):
return JSON.loads(self.text)

class _get:
def __init__(self, ws, wsUrl, wsData, headers=None, encryption=None, identifiers=None, timeout=None, debug=False):
def __init__(self, ws, wsUrl, wsData, headers={}, encryption=None, identifiers=None, timeout=None, debug=False):
if wsUrl != wsData["CURRENT_URL"]:
wsData["CURRENT_URL"] = wsUrl
ws = create_connection(wsUrl, header=headers, enable_multithread=True)
Expand Down Expand Up @@ -59,7 +59,7 @@ def funcWaitForResponse(identifiers):
self.wsData = wsData

class _post:
def __init__(self, ws, wsUrl, wsData, headers=None, encryption=None, data=None, json=None, waitForResponse=True, identifiers=None, timeout=None, debug=False):
def __init__(self, ws, wsUrl, wsData, headers={}, encryption=None, data=None, json=None, waitForResponse=True, identifiers=None, timeout=None, debug=False):
if data == None and json == None:
exit("RequestsWS | Error #1: Data or json is needed")

Expand Down Expand Up @@ -117,14 +117,14 @@ def __init__(self, proxies=None, timeout=None):

self.connectionsKept = []

def get(self, wsUrl, headers=None, encryption=None, identifiers=None, timeout=None, debug=False):
def get(self, wsUrl, headers={}, encryption=None, identifiers=None, timeout=None, debug=False):
resp = _get(ws=self.ws, wsUrl=wsUrl, wsData=self.wsData, headers=headers, encryption=encryption, identifiers=identifiers, timeout=timeout, debug=debug)
self.ws = resp.ws
self.wsData = resp.wsData

return formatCorrectly(resp.text, resp.status_code)

def post(self, wsUrl, headers=None, encryption=None, data=None, json=None, waitForResponse=True, identifiers=None, timeout=None, debug=False):
def post(self, wsUrl, headers={}, encryption=None, data=None, json=None, waitForResponse=True, identifiers=None, timeout=None, debug=False):
resp = _post(ws=self.ws, wsUrl=wsUrl, wsData=self.wsData, headers=headers, encryption=encryption, data=data, json=json, waitForResponse=waitForResponse, identifiers=identifiers, timeout=timeout, debug=debug)
self.ws = resp.ws
self.wsData = resp.wsData
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
from pathlib import Path

VERSION = '0.0.16'
VERSION = '0.0.17'
DESCRIPTION = 'The Requests like WS module'
long_description = (Path(__file__).parent / "README.md").read_text()

Expand Down

0 comments on commit e3ff729

Please sign in to comment.