|
27 | 27 | joined_auth = ':'.join(map(str, basic_auth)).encode('utf-8') |
28 | 28 | ensa_infos={} |
29 | 29 | ensa_pass="" |
| 30 | +collections=[] |
30 | 31 | if( os.getenv('SOURCE','TAIGA') == 'TAIGA'): |
31 | 32 | url = f"{os.getenv('STC_API_BASEURL', 'https://taiga.archi.fr')}/taiga_libext/JsonRPC/api.php" |
32 | 33 | ensa_pass = os.getenv('STC_API_PASSENSA') + datetime.now().strftime('%Y%m%d') |
33 | 34 | ensa_infos = { |
34 | 35 | "code_ensa": os.getenv('STC_API_CODEENSA', 'lyon'), |
35 | 36 | "pass_ensa": hashlib.sha1(ensa_pass.encode()).hexdigest(), |
36 | 37 | } |
| 38 | + collections = [ |
| 39 | + { |
| 40 | + "function": export_ind, |
| 41 | + "method": "ExportInd", |
| 42 | + "params": { |
| 43 | + **ensa_infos, |
| 44 | + "type": "pri", |
| 45 | + "id": "*", |
| 46 | + }, |
| 47 | + }, |
| 48 | + { |
| 49 | + "function": export_ind, |
| 50 | + "method": "ExportInd", |
| 51 | + "params": { |
| 52 | + **ensa_infos, |
| 53 | + "type": "etd", |
| 54 | + "id": "*", |
| 55 | + }, |
| 56 | + }, |
| 57 | + { |
| 58 | + "function": export_ind, |
| 59 | + "method": "ExportInd", |
| 60 | + "params": { |
| 61 | + **ensa_infos, |
| 62 | + "type": "adm", |
| 63 | + "id": "*", |
| 64 | + }, |
| 65 | + }, |
| 66 | + { |
| 67 | + "function": export_ind, |
| 68 | + "method": "ExportInd", |
| 69 | + "params": { |
| 70 | + **ensa_infos, |
| 71 | + "type": "esn", |
| 72 | + "id": "*", |
| 73 | + }, |
| 74 | + }, |
| 75 | + { |
| 76 | + "function": export_pictures, |
| 77 | + "method": "ExportPhotos", |
| 78 | + "methodBase64": "ExportPhoto", |
| 79 | + "params": { |
| 80 | + **ensa_infos, |
| 81 | + "type": "etd", |
| 82 | + "id": "*", |
| 83 | + }, |
| 84 | + "paramsBase64": { |
| 85 | + "type": "etd", |
| 86 | + **ensa_infos, |
| 87 | + }, |
| 88 | + }, |
| 89 | + { |
| 90 | + "function": export_pictures, |
| 91 | + "method": "ExportPhotos", |
| 92 | + "methodBase64": "ExportPhoto", |
| 93 | + "params": { |
| 94 | + **ensa_infos, |
| 95 | + "type": "adm", |
| 96 | + "id": "*", |
| 97 | + }, |
| 98 | + "paramsBase64": { |
| 99 | + "type": "adm", |
| 100 | + **ensa_infos, |
| 101 | + }, |
| 102 | + }, |
| 103 | + { |
| 104 | + "function": export_pictures, |
| 105 | + "method": "ExportPhotos", |
| 106 | + "methodBase64": "ExportPhoto", |
| 107 | + "params": { |
| 108 | + **ensa_infos, |
| 109 | + "type": "esn", |
| 110 | + "id": "*", |
| 111 | + }, |
| 112 | + "paramsBase64": { |
| 113 | + "type": "esn", |
| 114 | + **ensa_infos, |
| 115 | + }, |
| 116 | + }, |
| 117 | + ] |
37 | 118 | print(ensa_infos) |
38 | 119 | else: |
39 | 120 | url=os.getenv('STC_API_BASEURL', '') |
| 121 | + collections = [ |
| 122 | + { |
| 123 | + "function": export_oasis, |
| 124 | + "method": "student", |
| 125 | + "params": { |
| 126 | + **ensa_infos, |
| 127 | + "type": "etd", |
| 128 | + "id": "*", |
| 129 | + }, |
| 130 | + } |
| 131 | + ] |
| 132 | + |
40 | 133 | headers = { |
41 | 134 | "Authorization": f"Basic {base64.b64encode(joined_auth).decode('utf-8')}", |
42 | 135 | "Content-Type": "application/json; charset=utf-8", |
43 | 136 | } |
44 | 137 |
|
45 | 138 | # print(headers) |
46 | 139 |
|
47 | | -collections = [ |
48 | | - { |
49 | | - "function": export_oasis, |
50 | | - "method": "student", |
51 | | - "params": { |
52 | | - **ensa_infos, |
53 | | - "type": "etd", |
54 | | - "id": "*", |
55 | | - }, |
56 | | - }, |
57 | | - |
58 | | -] |
59 | | - |
60 | 140 |
|
61 | 141 | async def main(): |
62 | 142 | parser = argparse.ArgumentParser() |
|
0 commit comments