-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.py
59 lines (54 loc) · 2.19 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import requests
from apicomponents.acl import ACL
from apicomponents.analysis import Analysis
from apicomponents.badge import Badge
from apicomponents.bom import Bom
from apicomponents.calculator import Calculator
from apicomponents.configproperty import ConfigProperty
from apicomponents.cwe import CWE
from apicomponents.finding import Finding
from apicomponents.ldap import LDAP
from apicomponents.license import License
from apicomponents.licensegroup import LicenseGroup
from apicomponents.metrics import Metrics
from apicomponents.permission import Permission
from apicomponents.policy import Policy
from apicomponents.project import Project
from apicomponents.projectProperty import ProjectProperty
from apicomponents.repository import Repository
from apicomponents.search import Search
from apicomponents.service import Service
from apicomponents.team import Team
from apicomponents.user import User
from apicomponents.violation import Violation
from apicomponents.violationAnalysis import ViolationAnalysis
from apicomponents.vulnerability import Vulnerability
class DependencyTrackAPI(Project, ProjectProperty, Vulnerability, Finding, License, Metrics, ACL, Bom, CWE, ConfigProperty, Badge, Calculator, Team, Permission, LDAP, Service, Violation, Repository, Analysis, Policy, ViolationAnalysis, LicenseGroup, Search, User):
def __init__(self, apiurl, apikey):
self.apiurl = apiurl
self.apikey = apikey
self.apicall = self.apiurl + "/api"
self.session = requests.Session()
self.session.headers.update({"X-Api-Key": f"{self.apikey}"})
self.session.headers.update({"Content-Type": "application/json"})
def version(self):
response = self.session.get(self.apicall + "/version")
return response.json()
# TODO: user API
# TODO: violationanalysis API
# TODO: team API
# TODO: service API
# TODO: improve service API
# TODO: default API
# TODO: search API
# TODO: advance Repository API and put into apicomponents
# TODO: violation API
# TODO: policy API
# TODO: policyCondition API
# TODO: permission API
# TODO: oidc API
# TODO: licenseGroup API
# TODO: ladp API
# TODO: component API
# TODO: calculator API
# TODO: improve analysis API and put into apicomponents