Skip to content

Commit bb08cfa

Browse files
committed
added note on thread-safety to docstring of YouTubeTranscriptApi constructor
1 parent 090a5db commit bb08cfa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

youtube_transcript_api/_api.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ def __init__(
3232
http_client: Optional[Session] = None,
3333
):
3434
"""
35+
Note on thread-safety: As this class will initialize a `requests.Session`
36+
object, it is not thread-safe. Make sure to initialize an instance of
37+
`YouTubeTranscriptApi` per thread, if used in a multi-threading scenario!
38+
3539
:param cookie_path: Path to a text file containing YouTube authorization cookies
3640
:param proxy_config: an optional ProxyConfig object, defining proxies used for
3741
all network requests. This can be used to work around your IP being blocked

0 commit comments

Comments
 (0)