Skip to content

Commit f7219e5

Browse files
João Guerreiroericfourrier
authored andcommitted
fix(docs): fix README examples
1 parent 5db101d commit f7219e5

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

README.md

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,16 @@ DOCUMENT = """
5757
client = GGClient(api_key=API_KEY)
5858

5959
# Check the health of the API and the API key used.
60-
health_obj, status = client.health_check()
61-
62-
if status != codes[r"\o/"]: # this is 200 but cooler
60+
if client.health_check().success:
61+
try:
62+
scan_result = client.content_scan(DOCUMENT)
63+
except Exception as exc:
64+
# Handle exceptions such as schema validation
65+
traceback.print_exc(2, file=sys.stderr)
66+
print(str(exc))
67+
print(scan_result)
68+
else:
6369
print("Invalid API Key")
64-
65-
try:
66-
scan_result = client.content_scan(DOCUMENT)
67-
except Exception as exc:
68-
# Handle exceptions such as schema validation
69-
traceback.print_exc(2, file=sys.stderr)
70-
print(str(exc))
71-
72-
print("Scan results:", scan_result.has_secrets, "-", scan_result.policy_break_count)
7370
```
7471

7572
### Scanning multiple files
@@ -79,11 +76,11 @@ API_KEY = os.getenv("GG_API_KEY")
7976
client = GGClient(api_key=API_KEY)
8077
# Create a list of dictionaries for scanning
8178
to_scan = []
82-
for name in glob.glob("**/*"):
79+
for name in glob.glob("**/*", recursive=True):
8380
with open(name) as fn:
8481
to_scan.append({"document": fn.read(), "filename": os.path.basename(name)})
8582

86-
scan, status_code = client.multi_content_scan(to_scan)
83+
scan = client.multi_content_scan(to_scan)
8784
```
8885

8986
### Transform results to dict or JSON

pygitguardian/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from .client import GGClient
33

44

5-
__version__ = "1.0.3"
5+
__version__ = "1.0.4"
66
GGClient._version = __version__
77

88
__all__ = [

0 commit comments

Comments
 (0)