3838 "pass_ensa" : hashlib .sha1 (ensa_pass .encode ()).hexdigest (),
3939}
4040
41- # print(ensa_infos)
41+ print (ensa_infos )
4242# print(headers)
4343
4444collections = [
5151 "id" : "*" ,
5252 },
5353 },
54- # {
55- # "function": export_ind,
56- # "method": "ExportInd",
57- # "params": {
58- # **ensa_infos,
59- # "type": "etd",
60- # "id": "*",
61- # },
62- # },
63- # {
64- # "function": export_ind,
65- # "method": "ExportInd",
66- # "params": {
67- # **ensa_infos,
68- # "type": "adm",
69- # "id": "*",
70- # },
71- # },
72- # {
73- # "function": export_ind,
74- # "method": "ExportInd",
75- # "params": {
76- # **ensa_infos,
77- # "type": "esn",
78- # "id": "*",
79- # },
80- # },
81- # {
82- # "function": export_pictures,
83- # "method": "ExportPhotos",
84- # "methodBase64": "ExportPhoto",
85- # "params": {
86- # **ensa_infos,
87- # "type": "etd",
88- # "id": "*",
89- # },
90- # "paramsBase64": {
91- # "type": "etd",
92- # **ensa_infos,
93- # },
94- # },
95- # {
96- # "function": export_pictures,
97- # "method": "ExportPhotos",
98- # "methodBase64": "ExportPhoto",
99- # "params": {
100- # **ensa_infos,
101- # "type": "adm",
102- # "id": "*",
103- # },
104- # "paramsBase64": {
105- # "type": "adm",
106- # **ensa_infos,
107- # },
108- # },
109- # {
110- # "function": export_pictures,
111- # "method": "ExportPhotos",
112- # "methodBase64": "ExportPhoto",
113- # "params": {
114- # **ensa_infos,
115- # "type": "esn",
116- # "id": "*",
117- # },
118- # "paramsBase64": {
119- # "type": "esn",
120- # **ensa_infos,
121- # },
122- # },
54+ {
55+ "function" : export_ind ,
56+ "method" : "ExportInd" ,
57+ "params" : {
58+ ** ensa_infos ,
59+ "type" : "etd" ,
60+ "id" : "*" ,
61+ },
62+ },
63+ {
64+ "function" : export_ind ,
65+ "method" : "ExportInd" ,
66+ "params" : {
67+ ** ensa_infos ,
68+ "type" : "adm" ,
69+ "id" : "*" ,
70+ },
71+ },
72+ {
73+ "function" : export_ind ,
74+ "method" : "ExportInd" ,
75+ "params" : {
76+ ** ensa_infos ,
77+ "type" : "esn" ,
78+ "id" : "*" ,
79+ },
80+ },
81+ {
82+ "function" : export_pictures ,
83+ "method" : "ExportPhotos" ,
84+ "methodBase64" : "ExportPhoto" ,
85+ "params" : {
86+ ** ensa_infos ,
87+ "type" : "etd" ,
88+ "id" : "*" ,
89+ },
90+ "paramsBase64" : {
91+ "type" : "etd" ,
92+ ** ensa_infos ,
93+ },
94+ },
95+ {
96+ "function" : export_pictures ,
97+ "method" : "ExportPhotos" ,
98+ "methodBase64" : "ExportPhoto" ,
99+ "params" : {
100+ ** ensa_infos ,
101+ "type" : "adm" ,
102+ "id" : "*" ,
103+ },
104+ "paramsBase64" : {
105+ "type" : "adm" ,
106+ ** ensa_infos ,
107+ },
108+ },
109+ {
110+ "function" : export_pictures ,
111+ "method" : "ExportPhotos" ,
112+ "methodBase64" : "ExportPhoto" ,
113+ "params" : {
114+ ** ensa_infos ,
115+ "type" : "esn" ,
116+ "id" : "*" ,
117+ },
118+ "paramsBase64" : {
119+ "type" : "esn" ,
120+ ** ensa_infos ,
121+ },
122+ },
123123]
124124
125125
@@ -130,10 +130,21 @@ async def main():
130130 parser .add_argument ('--an' , help = 'Année universitaire à importer' ,default = "0" )
131131 parser .add_argument ('--force' , help = "Force l'import et bypass le check du fingerprint" ,default = "0" )
132132 args = parser .parse_args ()
133- if args .an != 0 :
134- print (f"Import pour l'annee { args .an } " )
133+ if args .an != '0' :
134+ print (f"Import pour l'annee <{ args .an } >" )
135+ if args .an .isdigit ():
136+ args .an = int (args .an )
137+ if args .an < 2000 or args .an > datetime .now ().year + 1 :
138+ print ("Année invalide, doit être entre 2000 et l'année en cours + 1" )
139+ sys .exit (1 )
140+
141+ for col in collections :
142+ col .get ('params' )['au' ]= args .an
143+ else :
144+ annee_en_cours = datetime .now ().year
145+ print ("Import pour l'annee en cours <" + str (annee_en_cours ) + ">" )
135146 for col in collections :
136- col .get ('params' )['au' ]= int ( args . an )
147+ col .get ('params' )['au' ]= annee_en_cours
137148
138149 if args .run == 'taiga' or args .run == 'all' :
139150 logger .info ("Starting Taiga ind/pictures crawler..." )
0 commit comments