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.
1 parent b6ee7a7 commit 6e8e51cCopy full SHA for 6e8e51c
src/apify_shared/utils.py
@@ -4,6 +4,7 @@
4
import io
5
import json
6
import re
7
+import secrets
8
from datetime import datetime, timezone
9
from enum import Enum
10
from typing import Any, TypeVar, cast
@@ -115,3 +116,9 @@ def parse(key: str, value: object) -> object:
115
116
return {key: parse(key, value) for (key, value) in data.items()}
117
118
return data
119
+
120
+@ignore_docs
121
+def crypto_random_object_id(length: int = 17) -> str:
122
+ """Generates a random object ID."""
123
+ chars = 'abcdefghijklmnopqrstuvwxyzABCEDFGHIJKLMNOPQRSTUVWXYZ0123456789'
124
+ return ''.join(secrets.choice(chars) for _ in range(length))
0 commit comments