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 33from cryptojwt import KeyJar
44from cryptojwt .key_jar import init_key_jar
55from flask .app import Flask
6- from oidcop .utils import load_yaml_config
76
87from oidcrp import RPHandler
8+ from oidcrp .util import load_yaml_config
99
1010dir_path = os .path .dirname (os .path .realpath (__file__ ))
1111
Original file line number Diff line number Diff line change 66from http .cookiejar import Cookie
77from http .cookiejar import http2time
88
9+ import io
10+ import json
911import yaml
12+
1013from oidcservice import sanitize
1114from oidcservice .exception import TimeFormatError
1215from oidcservice .exception import WrongContentType
@@ -249,6 +252,28 @@ def load_configuration(filename):
249252
250253
251254def 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