We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
pathlib
iglob
1 parent b6057cf commit 9e9d342Copy full SHA for 9e9d342
README.md
@@ -80,11 +80,13 @@ else:
80
```py
81
API_KEY = os.getenv("GG_API_KEY")
82
client = GGClient(api_key=API_KEY)
83
+
84
# Create a list of dictionaries for scanning
-to_scan = []
85
-for name in glob.glob("**/*", recursive=True):
86
- with open(name) as fn:
87
- to_scan.append({"document": fn.read(), "filename": os.path.basename(name)})
+file_paths = (pathlib.Path(name) for name in glob.iglob("**/*", recursive=True))
+to_scan = [
+ {"filename": path.name, "document": path.read_text(errors="replace")}
88
+ for path in file_paths
89
+]
90
91
scan = client.multi_content_scan(to_scan)
92
```
0 commit comments