|
| 1 | + |
| 2 | +socketdev-python-sdk |
| 3 | +############### |
| 4 | + |
| 5 | +Purpose |
| 6 | +------- |
| 7 | + |
| 8 | +The Socket.dev Python SDK provides a wrapper around the Socket.dev REST API to simplify making calls to the API from Python. |
| 9 | + |
| 10 | +Initializing the module |
| 11 | +----------------------- |
| 12 | + |
| 13 | +.. code-block:: |
| 14 | +
|
| 15 | + from socketdev import SocketDev |
| 16 | + socket = SocketDev("REPLACE_ME") |
| 17 | +
|
| 18 | +Supported Functions |
| 19 | +------------------- |
| 20 | + |
| 21 | +npm.issues(package, version) |
| 22 | +"""""""""""""""""""""""""""" |
| 23 | +Retrieve the Issues associated with a package and version. |
| 24 | + |
| 25 | +**Usage:** |
| 26 | + |
| 27 | +.. code-block:: |
| 28 | +
|
| 29 | + from socketdev import SocketDev |
| 30 | + socket = SocketDev("REPLACE_ME") |
| 31 | + print(socket.npm.issues("hardhat-gas-report", "1.1.25")) |
| 32 | +
|
| 33 | +**PARAMETERS:** |
| 34 | + |
| 35 | +- **package (str)** - The name of the NPM package. |
| 36 | +- **version (str)** - The version of the NPM Package. |
| 37 | + |
| 38 | +npm.score(package, version) |
| 39 | +""""""""""""""""""""""""""" |
| 40 | +Retrieve the Issues associated with a package and version. |
| 41 | + |
| 42 | +**Usage:** |
| 43 | + |
| 44 | +.. code-block:: |
| 45 | +
|
| 46 | + from socketdev import SocketDev |
| 47 | + socket = SocketDev("REPLACE_ME") |
| 48 | + print(socket.npm.score("hardhat-gas-report", "1.1.25")) |
| 49 | +
|
| 50 | +**PARAMETERS:** |
| 51 | + |
| 52 | +- **package (str)** - The name of the NPM package. |
| 53 | +- **version (str)** - The version of the NPM Package. |
| 54 | + |
| 55 | +dependencies.get(limit, offset) |
| 56 | +"""""""""""""""""" |
| 57 | +Retrieve the dependencies for the organization associated with the API Key |
| 58 | + |
| 59 | +**Usage:** |
| 60 | + |
| 61 | +.. code-block:: |
| 62 | +
|
| 63 | + from socketdev import SocketDev |
| 64 | + socket = SocketDev("REPLACE_ME") |
| 65 | + print(socket.dependencies.get(10, 0)) |
| 66 | +
|
| 67 | +**PARAMETERS:** |
| 68 | + |
| 69 | +- **limit (int)** - The maximum number of dependencies to return |
| 70 | +- **offset (int)** - The index to start from for pulling the dependencies |
| 71 | + |
| 72 | +dependencies.post(files, params) |
| 73 | +"""""""""""""""""""""""""""""""" |
| 74 | +Retrieve the dependencies for the organization associated with the API Key |
| 75 | + |
| 76 | +**Usage:** |
| 77 | + |
| 78 | +.. code-block:: |
| 79 | +
|
| 80 | + from socketdev import SocketDev |
| 81 | + socket = SocketDev("REPLACE_ME") |
| 82 | + file_names = [ |
| 83 | + "path/to/package.json" |
| 84 | + ] |
| 85 | + params = { |
| 86 | + "repository": "username/repo-name", |
| 87 | + "branch": "dependency-branch |
| 88 | + } |
| 89 | + print(socket.dependencies.post(file_names, params)) |
| 90 | +
|
| 91 | +**PARAMETERS:** |
| 92 | + |
| 93 | +- **files (list)** - The file paths of the manifest files to import into the Dependency API. |
| 94 | +- **params (dict)** - A dictionary of the `repository` and `branch` options for the API |
| 95 | + |
| 96 | +org.get() |
| 97 | +""""""""" |
| 98 | +Retrieve the Socket.dev org information |
| 99 | + |
| 100 | +**Usage:** |
| 101 | + |
| 102 | +.. code-block:: |
| 103 | +
|
| 104 | + from socketdev import SocketDev |
| 105 | + socket = SocketDev("REPLACE_ME") |
| 106 | + print(socket.org.get()) |
| 107 | +
|
| 108 | +quota.get() |
| 109 | +""""""""""" |
| 110 | +Retrieve the the current quota available for your API Key |
| 111 | + |
| 112 | +**Usage:** |
| 113 | + |
| 114 | +.. code-block:: |
| 115 | +
|
| 116 | + from socketdev import SocketDev |
| 117 | + socket = SocketDev("REPLACE_ME") |
| 118 | + print(socket.quota.get()) |
| 119 | +
|
| 120 | +report.list() |
| 121 | +""""""""""""" |
| 122 | +Retrieve the list of all reports for the organization |
| 123 | + |
| 124 | +**Usage:** |
| 125 | + |
| 126 | +.. code-block:: |
| 127 | +
|
| 128 | + from socketdev import SocketDev |
| 129 | + socket = SocketDev("REPLACE_ME") |
| 130 | + print(socket.report.list()) |
| 131 | +
|
| 132 | +report.delete(report_id) |
| 133 | +"""""""""""""""""""""""" |
| 134 | +Delete the specified report |
| 135 | + |
| 136 | +**Usage:** |
| 137 | + |
| 138 | +.. code-block:: |
| 139 | +
|
| 140 | + from socketdev import SocketDev |
| 141 | + socket = SocketDev("REPLACE_ME") |
| 142 | + print(socket.report.delete("report-id")) |
| 143 | +
|
| 144 | +**PARAMETERS:** |
| 145 | + |
| 146 | +- **report_id (str)** - The report ID of the report to delete |
| 147 | + |
| 148 | +report.view(report_id) |
| 149 | +"""""""""""""""""""""" |
| 150 | +Retrieve the information for a Project Health Report |
| 151 | + |
| 152 | +**Usage:** |
| 153 | + |
| 154 | +.. code-block:: |
| 155 | +
|
| 156 | + from socketdev import SocketDev |
| 157 | + socket = SocketDev("REPLACE_ME") |
| 158 | + print(socket.report.view("report_id")) |
| 159 | +
|
| 160 | +**PARAMETERS:** |
| 161 | + |
| 162 | +- **report_id (str)** - The report ID of the report to view |
| 163 | + |
| 164 | +report.supported() |
| 165 | +"""""""""""""""""" |
| 166 | +Retrieve the supported types of manifest files for creating a report |
| 167 | + |
| 168 | +**Usage:** |
| 169 | + |
| 170 | +.. code-block:: |
| 171 | +
|
| 172 | + from socketdev import SocketDev |
| 173 | + socket = SocketDev("REPLACE_ME") |
| 174 | + print(socket.report.supported()) |
| 175 | +
|
| 176 | +report.create(files) |
| 177 | +"""""""""""""""""""" |
| 178 | +Create a new project health report with the provided files |
| 179 | + |
| 180 | +**Usage:** |
| 181 | + |
| 182 | +.. code-block:: |
| 183 | +
|
| 184 | + from socketdev import SocketDev |
| 185 | + socket = SocketDev("REPLACE_ME") |
| 186 | + files = [ |
| 187 | + "/path/to/manifest/package.json" |
| 188 | + ] |
| 189 | + print(socket.report.create(files)) |
| 190 | +
|
| 191 | +**PARAMETERS:** |
| 192 | + |
| 193 | +- **files (list)** - List of file paths of manifest files |
| 194 | + |
| 195 | +repositories.get() |
| 196 | +"""""""""""""""""" |
| 197 | +Get a list of information about the tracked repositores |
| 198 | + |
| 199 | +**Usage:** |
| 200 | + |
| 201 | +.. code-block:: |
| 202 | +
|
| 203 | + from socketdev import SocketDev |
| 204 | + socket = SocketDev("REPLACE_ME") |
| 205 | + print(socket.repositories.get()) |
| 206 | +
|
| 207 | +settings.get() |
| 208 | +"""""""""""""" |
| 209 | +Retrieve the Socket Organization Settings |
| 210 | + |
| 211 | +**Usage:** |
| 212 | + |
| 213 | +.. code-block:: |
| 214 | +
|
| 215 | + from socketdev import SocketDev |
| 216 | + socket = SocketDev("REPLACE_ME") |
| 217 | + print(socket.settings.get()) |
0 commit comments