Skip to content

Commit

Permalink
Add conan package manager API
Browse files Browse the repository at this point in the history
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
  • Loading branch information
TG1999 committed Mar 27, 2023
1 parent edda714 commit e6d9e61
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions vulnerabilities/package_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,22 @@ def fetch(self, pkg: str) -> Iterable[PackageVersion]:
)


class ConanVersionAPI(VersionAPI):
"""
Fetch versions of Erlang packages from the hex API
"""

package_type = "conan"

def fetch(self, pkg: str) -> Iterable[PackageVersion]:
response = get_response(
url=f"https://conan.io/center/api/ui/details?name={pkg}&user=_&channel=_",
content_type="json",
)
for release in response["versions"]:
yield PackageVersion(value=release["version"])


class GoproxyVersionAPI(VersionAPI):
"""
Fetch versions of Go "golang" packages from the Go proxy API
Expand Down Expand Up @@ -688,6 +704,7 @@ def fetch(self, pkg: str) -> Iterable[PackageVersion]:
CratesVersionAPI,
DebianVersionAPI,
GitHubTagsAPI,
ConanVersionAPI,
}

VERSION_API_CLASSES_BY_PACKAGE_TYPE = {cls.package_type: cls for cls in VERSION_API_CLASSES}
Expand Down

0 comments on commit e6d9e61

Please sign in to comment.