This repository was archived by the owner on Jun 1, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +29
-4
lines changed Expand file tree Collapse file tree 2 files changed +29
-4
lines changed Original file line number Diff line number Diff line change 3
3
from cryptojwt import KeyJar
4
4
from cryptojwt .key_jar import init_key_jar
5
5
from flask .app import Flask
6
- from oidcop .utils import load_yaml_config
7
6
8
7
from oidcrp import RPHandler
8
+ from oidcrp .util import load_yaml_config
9
9
10
10
dir_path = os .path .dirname (os .path .realpath (__file__ ))
11
11
Original file line number Diff line number Diff line change 6
6
from http .cookiejar import Cookie
7
7
from http .cookiejar import http2time
8
8
9
+ import io
10
+ import json
9
11
import yaml
12
+
10
13
from oidcservice import sanitize
11
14
from oidcservice .exception import TimeFormatError
12
15
from oidcservice .exception import WrongContentType
@@ -249,6 +252,28 @@ def load_configuration(filename):
249
252
250
253
251
254
def do_add_ons (add_ons , services ):
252
- for key , spec in add_ons .items ():
253
- _func = importer (spec ['function' ])
254
- _func (services , ** spec ['kwargs' ])
255
+ for key , spec in add_ons .items ():
256
+ _func = importer (spec ['function' ])
257
+ _func (services , ** spec ['kwargs' ])
258
+
259
+
260
+ def load_json (file_name ):
261
+ with open (file_name ) as fp :
262
+ js = json .load (fp )
263
+ return js
264
+
265
+
266
+ def load_yaml_config (file_name ):
267
+ with open (file_name ) as fp :
268
+ c = yaml .safe_load (fp )
269
+ return c
270
+
271
+
272
+ def yaml_to_py_stream (file_name ):
273
+ d = load_yaml_config (file_name )
274
+ fstream = io .StringIO ()
275
+ for i in d :
276
+ section = '{} = {}\n \n ' .format (i , json .dumps (d [i ], indent = 2 ))
277
+ fstream .write (section )
278
+ fstream .seek (0 )
279
+ return fstream
You can’t perform that action at this time.
0 commit comments