Skip to content

Commit 2c301e2

Browse files
authored
Doug/add new features (#7)
* Fixed README documentation bug, added in create_packages_dict to be used in Python CLI and Sync tool for consistency * Prepped SDK for deploying to pypi * Added buld script * Finished preparing for pypi push * Removing unneeded setup.cfg * Fixed incorrect call for getting settings * Fixed bug in logic for from_time for * Fixed incorrect time interval * Building new pypi version * Minor fixes to logic
1 parent bf0e3a4 commit 2c301e2

16 files changed

+2979
-152
lines changed

Diff for: .github/CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @SocketDev/eng
1+
* @socketdev/eng

Diff for: .gitignore

+7-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,10 @@ venv
66
*.zip
77
*.pyc
88
test.py
9-
.venv
9+
.venv
10+
build
11+
dist
12+
*.build
13+
*.dist
14+
*.egg-info
15+
*.cpython-312.pyc

Diff for: LICENSE

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Socket
3+
Copyright (c) 2022 Socket Inc
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

Diff for: Pipfile

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
requests = "*"
8+
9+
[dev-packages]
10+
twine = "*"
11+
wheel = "*"
12+
build = "*"
13+
14+
[requires]
15+
python_version = "3.12"

Diff for: Pipfile.lock

+472
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: README.rst

+62-53
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

2-
socketdev-python-sdk
3-
###############
2+
socket-python-sdk
3+
#################
44

55
Purpose
66
-------
@@ -14,8 +14,13 @@ Initializing the module
1414

1515
.. code-block::
1616
17-
from socketdev import SocketDev
18-
socket = SocketDev("REPLACE_ME")
17+
from socketdev import socketdev
18+
socket = socketdev(token="REPLACE_ME", timeout=30)
19+
20+
**PARAMETERS:**
21+
22+
- **token (str)** - The Socket API Key for your Organization
23+
- **Timeout (int)** - The number of seconds to wait before failing the connection
1924

2025
Supported Functions
2126
-------------------
@@ -28,8 +33,8 @@ Retrieve the Issues associated with a package and version.
2833

2934
.. code-block::
3035
31-
from socketdev import SocketDev
32-
socket = SocketDev("REPLACE_ME")
36+
from socketdev import socketdev
37+
socket = socketdev(token="REPLACE_ME")
3338
print(socket.npm.issues("hardhat-gas-report", "1.1.25"))
3439
3540
**PARAMETERS:**
@@ -45,8 +50,8 @@ Retrieve the Issues associated with a package and version.
4550

4651
.. code-block::
4752
48-
from socketdev import SocketDev
49-
socket = SocketDev("REPLACE_ME")
53+
from socketdev import socketdev
54+
socket = socketdev(token="REPLACE_ME")
5055
print(socket.npm.score("hardhat-gas-report", "1.1.25"))
5156
5257
**PARAMETERS:**
@@ -55,15 +60,15 @@ Retrieve the Issues associated with a package and version.
5560
- **version (str)** - The version of the NPM Package.
5661

5762
dependencies.get(limit, offset)
58-
""""""""""""""""""
63+
"""""""""""""""""""""""""""""""
5964
Retrieve the dependencies for the organization associated with the API Key
6065

6166
**Usage:**
6267

6368
.. code-block::
6469
65-
from socketdev import SocketDev
66-
socket = SocketDev("REPLACE_ME")
70+
from socketdev import socketdev
71+
socket = socketdev(token="REPLACE_ME")
6772
print(socket.dependencies.get(10, 0))
6873
6974
**PARAMETERS:**
@@ -79,8 +84,8 @@ Retrieve the dependencies for the organization associated with the API Key
7984

8085
.. code-block::
8186
82-
from socketdev import SocketDev
83-
socket = SocketDev("REPLACE_ME")
87+
from socketdev import socketdev
88+
socket = socketdev(token="REPLACE_ME")
8489
file_names = [
8590
"path/to/package.json"
8691
]
@@ -103,8 +108,8 @@ Retrieve the Socket.dev org information
103108

104109
.. code-block::
105110
106-
from socketdev import SocketDev
107-
socket = SocketDev("REPLACE_ME")
111+
from socketdev import socketdev
112+
socket = socketdev(token="REPLACE_ME")
108113
print(socket.org.get())
109114
110115
quota.get()
@@ -115,8 +120,8 @@ Retrieve the the current quota available for your API Key
115120

116121
.. code-block::
117122
118-
from socketdev import SocketDev
119-
socket = SocketDev("REPLACE_ME")
123+
from socketdev import socketdev
124+
socket = socketdev(token="REPLACE_ME")
120125
print(socket.quota.get())
121126
122127
report.list()
@@ -127,9 +132,13 @@ Retrieve the list of all reports for the organization
127132

128133
.. code-block::
129134
130-
from socketdev import SocketDev
131-
socket = SocketDev("REPLACE_ME")
132-
print(socket.report.list())
135+
from socketdev import socketdev
136+
socket = socketdev(token="REPLACE_ME")
137+
print(socket.report.list(from_time=1726183485))
138+
139+
**PARAMETERS:**
140+
141+
- **from_time (int)** - The Unix Timestamp in Seconds to limit the reports pulled
133142

134143
report.delete(report_id)
135144
""""""""""""""""""""""""
@@ -139,8 +148,8 @@ Delete the specified report
139148

140149
.. code-block::
141150
142-
from socketdev import SocketDev
143-
socket = SocketDev("REPLACE_ME")
151+
from socketdev import socketdev
152+
socket = socketdev(token="REPLACE_ME")
144153
print(socket.report.delete("report-id"))
145154
146155
**PARAMETERS:**
@@ -155,8 +164,8 @@ Retrieve the information for a Project Health Report
155164

156165
.. code-block::
157166
158-
from socketdev import SocketDev
159-
socket = SocketDev("REPLACE_ME")
167+
from socketdev import socketdev
168+
socket = socketdev(token="REPLACE_ME")
160169
print(socket.report.view("report_id"))
161170
162171
**PARAMETERS:**
@@ -171,8 +180,8 @@ Retrieve the supported types of manifest files for creating a report
171180

172181
.. code-block::
173182
174-
from socketdev import SocketDev
175-
socket = SocketDev("REPLACE_ME")
183+
from socketdev import socketdev
184+
socket = socketdev(token="REPLACE_ME")
176185
print(socket.report.supported())
177186
178187
report.create(files)
@@ -183,8 +192,8 @@ Create a new project health report with the provided files
183192

184193
.. code-block::
185194
186-
from socketdev import SocketDev
187-
socket = SocketDev("REPLACE_ME")
195+
from socketdev import socketdev
196+
socket = socketdev(token="REPLACE_ME")
188197
files = [
189198
"/path/to/manifest/package.json"
190199
]
@@ -202,8 +211,8 @@ Get a list of information about the tracked repositores
202211

203212
.. code-block::
204213
205-
from socketdev import SocketDev
206-
socket = SocketDev("REPLACE_ME")
214+
from socketdev import socketdev
215+
socket = socketdev(token="REPLACE_ME")
207216
print(socket.repositories.get())
208217
209218
settings.get()
@@ -214,36 +223,36 @@ Retrieve the Socket Organization Settings
214223

215224
.. code-block::
216225
217-
from socketdev import SocketDev
218-
socket = SocketDev("REPLACE_ME")
226+
from socketdev import socketdev
227+
socket = socketdev(token="REPLACE_ME")
219228
print(socket.settings.get())
220229
221230
sbom.view(report_id)
222-
""""""""""""""""""""""
231+
""""""""""""""""""""
223232
Retrieve the information for a SBOM Report
224233

225234
**Usage:**
226235

227236
.. code-block::
228237
229-
from socketdev import SocketDev
230-
socket = SocketDev("REPLACE_ME")
238+
from socketdev import socketdev
239+
socket = socketdev(token="REPLACE_ME")
231240
print(socket.sbom.view("report_id"))
232241
233242
**PARAMETERS:**
234243

235244
- **report_id (str)** - The report ID of the report to view
236245

237246
purl.post(license, components)
238-
""""""""""""""""""""""
247+
""""""""""""""""""""""""""""""
239248
Retrieve the package information for a purl post
240249

241250
**Usage:**
242251

243252
.. code-block::
244253
245-
from socketdev import SocketDev
246-
socket = SocketDev("REPLACE_ME")
254+
from socketdev import socketdev
255+
socket = socketdev(token="REPLACE_ME")
247256
license = "true"
248257
components = [
249258
{
@@ -261,31 +270,31 @@ Retrieve the package information for a purl post
261270
- **components (array{dict})** - The components list of packages urls
262271

263272
fullscans.get(org_slug)
264-
""""""""""""""""""""""
273+
"""""""""""""""""""""""
265274
Retrieve the Fullscans information for around Organization
266275

267276
**Usage:**
268277

269278
.. code-block::
270279
271-
from socketdev import SocketDev
272-
socket = SocketDev("REPLACE_ME")
280+
from socketdev import socketdev
281+
socket = socketdev(token="REPLACE_ME")
273282
print(socket.fullscans.get("org_slug"))
274283
275284
**PARAMETERS:**
276285

277286
- **org_slug (str)** - The organization name
278287

279288
fullscans.post(files, params)
280-
""""""""""""""""""""""
289+
"""""""""""""""""""""""""""""
281290
Create a full scan from a set of package manifest files. Returns a full scan including all SBOM artifacts.
282291

283292
**Usage:**
284293

285294
.. code-block::
286295
287-
from socketdev import SocketDev
288-
socket = SocketDev("REPLACE_ME")
296+
from socketdev import socketdev
297+
socket = socketdev(token="REPLACE_ME")
289298
files = [
290299
"/path/to/manifest/package.json"
291300
]
@@ -335,15 +344,15 @@ Create a full scan from a set of package manifest files. Returns a full scan inc
335344
+------------------------+------------+-------------------------------------------------------------------------------+
336345

337346
fullscans.delete(org_slug, full_scan_id)
338-
""""""""""""""""""""""
347+
""""""""""""""""""""""""""""""""""""""""
339348
Delete an existing full scan.
340349

341350
**Usage:**
342351

343352
.. code-block::
344353
345-
from socketdev import SocketDev
346-
socket = SocketDev("REPLACE_ME")
354+
from socketdev import socketdev
355+
socket = socketdev(token="REPLACE_ME")
347356
print(socket.fullscans.delete(org_slug, full_scan_id))
348357
349358
**PARAMETERS:**
@@ -352,15 +361,15 @@ Delete an existing full scan.
352361
- **full_scan_id (str)** - The ID of the full scan
353362

354363
fullscans.stream(org_slug, full_scan_id)
355-
""""""""""""""""""""""
364+
""""""""""""""""""""""""""""""""""""""""
356365
Stream all SBOM artifacts for a full scan.
357366

358367
**Usage:**
359368

360369
.. code-block::
361370
362-
from socketdev import SocketDev
363-
socket = SocketDev("REPLACE_ME")
371+
from socketdev import socketdev
372+
socket = socketdev(token="REPLACE_ME")
364373
print(socket.fullscans.stream(org_slug, full_scan_id))
365374
366375
**PARAMETERS:**
@@ -369,15 +378,15 @@ Stream all SBOM artifacts for a full scan.
369378
- **full_scan_id (str)** - The ID of the full scan
370379

371380
fullscans.metadata(org_slug, full_scan_id)
372-
""""""""""""""""""""""
381+
""""""""""""""""""""""""""""""""""""""""""
373382
Get metadata for a single full scan
374383

375384
**Usage:**
376385

377386
.. code-block::
378387
379-
from socketdev import SocketDev
380-
socket = SocketDev("REPLACE_ME")
388+
from socketdev import socketdev
389+
socket = socketdev(token="REPLACE_ME")
381390
print(socket.fullscans.metadata(org_slug, full_scan_id))
382391
383392
**PARAMETERS:**

0 commit comments

Comments
 (0)