Skip to content
This repository has been archived by the owner on Apr 27, 2023. It is now read-only.

Commit

Permalink
Fix Null Body
Browse files Browse the repository at this point in the history
  • Loading branch information
knassar702 committed Oct 31, 2021
1 parent 569d9ba commit 34c53af
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions core/libs/all/requester.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(self, opts : dict):
self.count: int = 0

# Send a request
def send(self, method: str = 'GET', url: Union[str, None] = None, body: dict = {}, headers: dict = {}, allow_redirects: bool = False, org: bool = True, timeout:int = 10, IgnoreErrors: bool = False, json=None) -> Response:
def send(self, method: str = 'GET', url: Union[str, None] = None, body: dict = {}, headers: dict = {}, allow_redirects: bool = False, org: bool = False, timeout:int = 10, IgnoreErrors: bool = False, json=None) -> Response:
try:
# Generate user agent
user_agents = Agent()
Expand Down Expand Up @@ -85,11 +85,12 @@ def send(self, method: str = 'GET', url: Union[str, None] = None, body: dict = {
if org:
if body:
log.debug('convert body to dict')
if body.startswith('?'):
pass
else:
body = '?' + body
body = post_data(body)
if type(body) == str:
if body.startswith('?'):
pass
else:
body = '?' + body
body = post_data(body)
if method != 'GET' and not body:
log.debug('convert body to dict')
body = post_data(url)
Expand All @@ -102,8 +103,7 @@ def send(self, method: str = 'GET', url: Union[str, None] = None, body: dict = {
json = body
else:
json = post_data(str(body))

body = None
body = {}
req = request(method, url, data=body, headers=headers, cookies=cookies, allow_redirects=allow_redirects, verify=False, timeout=timeout, proxies=proxy,json=json)
if self.delay > 0:
log.debug(f'sleep {self.delay}')
Expand Down

0 comments on commit 34c53af

Please sign in to comment.