Skip to content

Commit cb48225

Browse files
committed
release 1.2.2
1 parent 81d93fc commit cb48225

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "reait"
7-
version = "1.2.3"
7+
version = "1.2.2"
88
readme = "README.md"
99
classifiers=[
1010
"Programming Language :: Python :: 3",

src/reait/api.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from requests import request, Response, HTTPError
1616
from sklearn.metrics.pairwise import cosine_similarity
1717

18-
__version__ = "1.2.3"
18+
__version__ = "1.2.2"
1919

2020
re_conf = {
2121
"apikey": environ.get("REAI_API_KEY", ""),
@@ -33,7 +33,8 @@ def __init__(self, reason: str, end_point: str = None):
3333

3434
response.reason = reason
3535
response.status_code = 404
36-
response._content = b'{"success": false, "error": "' + reason.encode() + b'"}'
36+
response._content = b'{"success": false, "error": "' + \
37+
reason.encode() + b'"}'
3738
response.url = (
3839
f"{re_conf['host']}/{end_point if end_point[0] != '/' else end_point[1:]}"
3940
if end_point
@@ -65,7 +66,8 @@ def reveng_req(
6566
:param files: Dictionary of files to send to the specified URL
6667
"""
6768
url = f"{re_conf['host']}/{end_point if end_point[0] != '/' else end_point[1:]}"
68-
headers = {"Authorization": re_conf["apikey"], "User-Agent": re_conf["user_agent"]}
69+
headers = {"Authorization": re_conf["apikey"],
70+
"User-Agent": re_conf["user_agent"]}
6971

7072
if ex_headers:
7173
headers.update(ex_headers)
@@ -323,7 +325,8 @@ def RE_analyse(
323325
)
324326
elif res.status_code == 400:
325327
if "error" in res.json().keys():
326-
logger.warning("Error analysing %s - %s", fpath, res.json()["error"])
328+
logger.warning("Error analysing %s - %s",
329+
fpath, res.json()["error"])
327330

328331
res.raise_for_status()
329332
return res
@@ -337,15 +340,17 @@ def RE_upload(fpath: str) -> Response:
337340
bin_id = re_binary_id(fpath)
338341

339342
with open(fpath, "rb") as fd:
340-
res: Response = reveng_req(requests.post, "v1/upload", files={"file": fd})
343+
res: Response = reveng_req(
344+
requests.post, "v1/upload", files={"file": fd})
341345

342346
if res.ok:
343347
logger.info(
344348
"Successfully uploaded binary to your account. %s - %s", fpath, bin_id
345349
)
346350
elif res.status_code == 400:
347351
if "error" in res.json().keys():
348-
logger.warning("Error uploading %s - %s", fpath, res.json()["error"])
352+
logger.warning("Error uploading %s - %s",
353+
fpath, res.json()["error"])
349354
elif res.status_code == 413:
350355
logger.warning("File too large. Please upload files under 10MB.")
351356
elif res.status_code == 500:
@@ -528,7 +533,8 @@ def RE_nearest_symbols_batch(
528533
if binaries:
529534
params["binaries_search_list"] = binaries
530535

531-
res: Response = reveng_req(requests.post, "v1/ann/symbol/batch", json_data=params)
536+
res: Response = reveng_req(
537+
requests.post, "v1/ann/symbol/batch", json_data=params)
532538

533539
res.raise_for_status()
534540
return res
@@ -649,9 +655,11 @@ def RE_functions_rename(function_id: int, new_name: str) -> Response:
649655
)
650656

651657
if res.ok:
652-
logger.info("FunctionId %d has been renamed with '%s'.", function_id, new_name)
658+
logger.info("FunctionId %d has been renamed with '%s'.",
659+
function_id, new_name)
653660
else:
654-
logger.warning("Error, cannot rename FunctionId %d. %s", function_id, res.text)
661+
logger.warning("Error, cannot rename FunctionId %d. %s",
662+
function_id, res.text)
655663

656664
res.raise_for_status()
657665
return res
@@ -749,7 +757,8 @@ def RE_function_callers_callees(function: int) -> Response:
749757
Get the callers and callees of a functions
750758
:param function: Function ID
751759
"""
752-
res: Response = reveng_req(requests.get, f"v2/functions/{function}/callees_callers")
760+
res: Response = reveng_req(
761+
requests.get, f"v2/functions/{function}/callees_callers")
753762

754763
res.raise_for_status()
755764
return res
@@ -760,7 +769,8 @@ def RE_analysis_info(analysis_id: int) -> Response:
760769
Get the analysis information
761770
:param analysis_id: Analysis ID
762771
"""
763-
res: Response = reveng_req(requests.get, f"v2/analyses/{analysis_id}/info/basic")
772+
res: Response = reveng_req(
773+
requests.get, f"v2/analyses/{analysis_id}/info/basic")
764774

765775
res.raise_for_status()
766776
return res

0 commit comments

Comments
 (0)