We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1a41831 commit 724a67eCopy full SHA for 724a67e
railib/rest.py
@@ -16,7 +16,7 @@
16
17
import json
18
import logging
19
-from os import path
+from os import path, makedirs
20
from urllib.error import URLError
21
from urllib.parse import urlencode, urlsplit, quote
22
from urllib.request import Request, urlopen
@@ -151,6 +151,8 @@ def _read_token_cache(creds: ClientCredentials) -> AccessToken:
151
# write access token to cache
152
def _write_token_cache(creds: ClientCredentials):
153
try:
154
+ cache_dir = path.dirname(_cache_file())
155
+ makedirs(cache_dir, exist_ok=True)
156
cache = _read_cache()
157
cache[creds.client_id] = creds.access_token
158
with open(_cache_file(), 'w') as f:
0 commit comments