mirror of
https://github.com/github/codeql.git
synced 2025-12-21 19:26:31 +01:00
Python: Add httpx model
This commit is contained in:
committed by
Rasmus Wriedt Larsen
parent
6128c89518
commit
699b6b8bef
@@ -9,15 +9,18 @@
|
||||
private import python
|
||||
private import semmle.python.Concepts
|
||||
private import semmle.python.ApiGraphs
|
||||
private import semmle.python.frameworks.data.ModelsAsData
|
||||
|
||||
/**
|
||||
* INTERNAL: Do not use.
|
||||
*
|
||||
* Provides models for the `httpx` PyPI package.
|
||||
*
|
||||
* See
|
||||
* - https://pypi.org/project/httpx/
|
||||
* - https://www.python-httpx.org/
|
||||
*/
|
||||
private module HttpxModel {
|
||||
module HttpxModel {
|
||||
/**
|
||||
* An outgoing HTTP request, from the `httpx` library.
|
||||
*
|
||||
@@ -59,8 +62,10 @@ private module HttpxModel {
|
||||
*/
|
||||
module Client {
|
||||
/** Get a reference to the `httpx.Client` or `httpx.AsyncClient` class. */
|
||||
private API::Node classRef() {
|
||||
API::Node classRef() {
|
||||
result = API::moduleImport("httpx").getMember(["Client", "AsyncClient"])
|
||||
or
|
||||
result = ModelOutput::getATypeNode("httpx.Client~Subclass").getASubclass*()
|
||||
}
|
||||
|
||||
/** A method call on a Client that sends off a request */
|
||||
|
||||
@@ -18,6 +18,7 @@ private import semmle.python.frameworks.Starlette
|
||||
private import semmle.python.frameworks.ClickhouseDriver
|
||||
private import semmle.python.frameworks.Aiohttp
|
||||
private import semmle.python.frameworks.Fabric
|
||||
private import semmle.python.frameworks.Httpx
|
||||
import semmle.python.frameworks.data.internal.ApiGraphModelsExtensions as Extensions
|
||||
|
||||
class FlaskViewClasses extends FindSubclassesSpec {
|
||||
@@ -287,6 +288,12 @@ class FlaskBlueprint extends FindSubclassesSpec {
|
||||
override API::Node getAlreadyModeledClass() { result = Flask::Blueprint::classRef() }
|
||||
}
|
||||
|
||||
class HttpxClient extends FindSubclassesSpec {
|
||||
HttpxClient() { this = "httpx.Client~Subclass" }
|
||||
|
||||
override API::Node getAlreadyModeledClass() { result = HttpxModel::Client::classRef() }
|
||||
}
|
||||
|
||||
bindingset[fullyQualified]
|
||||
predicate fullyQualifiedToYamlFormat(string fullyQualified, string type2, string path) {
|
||||
exists(int firstDot | firstDot = fullyQualified.indexOf(".", 0, 0) |
|
||||
|
||||
Reference in New Issue
Block a user