Skip to content

Commit

Permalink
Fixed bugs in PM obj creation, bumped numpy/mkdocs-material
Browse files Browse the repository at this point in the history
  • Loading branch information
jake-lindsay-tfs committed Dec 9, 2024
1 parent 6f64c11 commit b50b2e6
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 75 deletions.
120 changes: 60 additions & 60 deletions poetry.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "qualysdk"
version = "0.2.0"
version = "0.2.1"
description = "SDK for interacting with Qualys APIs, across most modules the platform offers."
authors = ["0x41424142 <jake@jakelindsay.uk>", "0x4A616B65 <jake.lindsay@thermofisher.com>"]
maintainers = ["Jake Lindsay <jake@jakelindsay.uk>"]
Expand Down Expand Up @@ -28,11 +28,11 @@ lxml = "^5.2.2"
pandas = "^2.2.2"
mkdocs = "^1.6.0"
sqlalchemy = "^2.0.32"
numpy = "^2.0.1"
numpy = "^2.2.0"
pymssql = "^2.3.2"
pymysql = "^1.1.1"
pymdown-extensions = "^10.9"
mkdocs-material = "9.5.46"
mkdocs-material = "^9.5.48"
psycopg2 = {version = "^2.9.9", platform = "win32"}
psycopg2-binary = [
{version = "^2.9.9", platform = "linux"},
Expand Down
11 changes: 11 additions & 0 deletions qualysdk/pm/data_classes/Job.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,23 @@ def __post_init__(self):
setattr(self, base_list_field, BaseList(getattr(self, base_list_field)))

for tag_obj in TAG_OBJ_FIELDS:
obj_bl = BaseList()
if getattr(self, tag_obj):
for tag in getattr(self, tag_obj):
if tag_obj == 'exclusionTags':
obj_bl.append(Tag.from_dict({'id': tag}))
else:
obj_bl.append(Tag.from_dict(tag))
setattr(self, tag_obj, obj_bl)

'''
if getattr(self, tag_obj):
setattr(
self,
tag_obj,
BaseList([Tag.from_dict(tag) for tag in getattr(self, tag_obj)]),
)
'''

for dt_field in BREAKDOWN_DT_FIELDS:
if getattr(self, dt_field):
Expand Down
2 changes: 1 addition & 1 deletion qualysdk/pm/data_classes/JobResultSummary.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __post_init__(self):
asset_dict[key] = value

asset_dict["jobId"] = self.id
bl.append(PMAssetJobView.from_dict(**asset_dict))
bl.append(PMAssetJobView.from_dict(asset_dict))
setattr(self, "assets", bl)

def __getitem__(self, key):
Expand Down
7 changes: 1 addition & 6 deletions qualysdk/pm/data_classes/PMAsset.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ class PMInterface(BaseClass):
def __str__(self):
return self.address

@classmethod
def from_dict(cls, **kwargs):
return cls(**kwargs)


@dataclass
class PMAssetJobView(BaseClass):
"""
Expand Down Expand Up @@ -124,7 +119,7 @@ def __post_init__(self):
if self.interfaces:
bl = BaseList()
for interface in self.interfaces:
bl.append(PMInterface.from_dict(**interface))
bl.append(PMInterface.from_dict(interface))
setattr(self, "interfaces", bl)

if self.tags:
Expand Down
8 changes: 4 additions & 4 deletions qualysdk/pm/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def _list_jobs_backend(

# Protect BaseList if threads are used:
with lock:
responses.extend([PMJob.from_dict(**job) for job in parsed])
responses.extend([PMJob.from_dict(job) for job in parsed])

if page_count != "all":
pages_pulled += 1
Expand Down Expand Up @@ -269,11 +269,11 @@ def get_job_results(
auth=auth, method="POST", _use_singular_in_url=True, **kwargs_no_bl
)
if not kwargs.get("_response_bl") and kwargs.get("_response_bl") != BaseList():
return JobResultSummary.from_dict(**result.json())
return JobResultSummary.from_dict(result.json())
else:
with lock:
kwargs["_response_bl"].extend(
[JobResultSummary.from_dict(**result.json())]
[JobResultSummary.from_dict(result.json())]
)
return

Expand Down Expand Up @@ -347,7 +347,7 @@ def get_job_runs(
for run in result:
run["jobId"] = jobId

return BaseList([PMRun.from_dict(**run) for run in result])
return BaseList([PMRun.from_dict(run) for run in result])


def remove_none_values(d):
Expand Down
2 changes: 1 addition & 1 deletion qualysdk/pm/vulnerabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,4 @@ def lookup_cves(
if response.status_code not in range(200, 299):
raise QualysAPIError(response.text)

return BaseList([PMVulnerability.from_dict(**qid) for qid in response.json()])
return BaseList([PMVulnerability.from_dict(qid) for qid in response.json()])

0 comments on commit b50b2e6

Please sign in to comment.