Skip to content

Commit b957d6f

Browse files
committed
Create directory as needed.
1 parent 64515a9 commit b957d6f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/cryptojwt/jwk/jwk.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ def jwk_wrap(key, use="", kid=""):
177177

178178
def dump_jwk(filename, key):
179179
"""Writes a RSAKey, ECKey or SYMKey instance as a JWK to a file."""
180+
head, tail = os.path.split(filename)
181+
if head and not os.path.isdir(head):
182+
os.makedirs(head)
183+
180184
with open(filename, 'w') as fp:
181185
fp.write(json.dumps(key.to_dict()))
182186

0 commit comments

Comments
 (0)