ghostbit-cli 1.1.0__tar.gz → 1.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ghostbit-cli
3
- Version: 1.1.0
3
+ Version: 1.1.1
4
4
  Summary: Ghostbit CLI — create end-to-end encrypted pastes from the terminal
5
5
  License-Expression: MIT
6
6
  Project-URL: Homepage, https://github.com/stackopshq/ghostbit
@@ -23,6 +23,7 @@ Classifier: Topic :: Utilities
23
23
  Requires-Python: >=3.10
24
24
  Description-Content-Type: text/markdown
25
25
  Requires-Dist: cryptography>=42.0.0
26
+ Requires-Dist: certifi
26
27
  Provides-Extra: color
27
28
  Requires-Dist: pygments>=2.17.0; extra == "color"
28
29
  Provides-Extra: markdown
@@ -16,15 +16,23 @@ import base64
16
16
  import getpass
17
17
  import json
18
18
  import os
19
+ import ssl
19
20
  import sys
20
21
  import time
21
22
  import urllib.error
22
23
  import urllib.request
23
24
  from pathlib import Path
24
25
 
25
- __version__ = "1.1.0"
26
+ __version__ = "1.1.1"
26
27
  _USER_AGENT = f"Ghostbit-CLI/{__version__}"
27
28
 
29
+ # Build an SSL context that works on macOS (certifi) and everywhere else.
30
+ try:
31
+ import certifi
32
+ _SSL_CTX = ssl.create_default_context(cafile=certifi.where())
33
+ except ImportError:
34
+ _SSL_CTX = ssl.create_default_context()
35
+
28
36
  LANGUAGES = [
29
37
  "python", "javascript", "typescript", "go", "rust", "ruby", "php",
30
38
  "java", "c", "cpp", "csharp", "bash", "powershell", "html", "css",
@@ -333,7 +341,7 @@ def cmd_view(args):
333
341
  api_url = f"{server}/api/v1/pastes/{paste_id}"
334
342
  req = urllib.request.Request(api_url, headers={"User-Agent": _USER_AGENT})
335
343
  try:
336
- with urllib.request.urlopen(req, timeout=15) as resp:
344
+ with urllib.request.urlopen(req, timeout=15, context=_SSL_CTX) as resp:
337
345
  data = json.loads(resp.read())
338
346
  except urllib.error.HTTPError as e:
339
347
  body = e.read().decode(errors="replace")
@@ -394,7 +402,7 @@ def _api_create(server: str, payload: dict) -> dict:
394
402
  method="POST",
395
403
  )
396
404
  try:
397
- with urllib.request.urlopen(req, timeout=15) as resp:
405
+ with urllib.request.urlopen(req, timeout=15, context=_SSL_CTX) as resp:
398
406
  return json.loads(resp.read())
399
407
  except urllib.error.HTTPError as e:
400
408
  body = e.read().decode(errors="replace")
@@ -461,7 +469,7 @@ def cmd_delete(url: str) -> None:
461
469
  method="DELETE",
462
470
  )
463
471
  try:
464
- with urllib.request.urlopen(req, timeout=15):
472
+ with urllib.request.urlopen(req, timeout=15, context=_SSL_CTX):
465
473
  pass
466
474
  print(f"Deleted {paste_id}.")
467
475
  except urllib.error.HTTPError as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ghostbit-cli
3
- Version: 1.1.0
3
+ Version: 1.1.1
4
4
  Summary: Ghostbit CLI — create end-to-end encrypted pastes from the terminal
5
5
  License-Expression: MIT
6
6
  Project-URL: Homepage, https://github.com/stackopshq/ghostbit
@@ -23,6 +23,7 @@ Classifier: Topic :: Utilities
23
23
  Requires-Python: >=3.10
24
24
  Description-Content-Type: text/markdown
25
25
  Requires-Dist: cryptography>=42.0.0
26
+ Requires-Dist: certifi
26
27
  Provides-Extra: color
27
28
  Requires-Dist: pygments>=2.17.0; extra == "color"
28
29
  Provides-Extra: markdown
@@ -1,4 +1,5 @@
1
1
  cryptography>=42.0.0
2
+ certifi
2
3
 
3
4
  [all]
4
5
  pygments>=2.17.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ghostbit-cli"
7
- version = "1.1.0"
7
+ version = "1.1.1"
8
8
  description = "Ghostbit CLI — create end-to-end encrypted pastes from the terminal"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -27,6 +27,7 @@ classifiers = [
27
27
  ]
28
28
  dependencies = [
29
29
  "cryptography>=42.0.0",
30
+ "certifi",
30
31
  ]
31
32
 
32
33
  [project.optional-dependencies]
File without changes
File without changes
File without changes