diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 8e6455c..a74abfd 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,15 +1,10 @@ - - + - - - - - + @@ -403,7 +405,6 @@ - @@ -428,6 +429,7 @@ - \ No newline at end of file diff --git a/Log/log_file.log b/Log/log_file.log index f4de348..6911460 100644 --- a/Log/log_file.log +++ b/Log/log_file.log @@ -1659561,3 +1659561,280 @@ INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\S INFO:apscheduler.scheduler:Scheduler has been shut down DEBUG:apscheduler.scheduler:Looking for jobs to run DEBUG:apscheduler.scheduler:No jobs; waiting until a job is added +INFO:werkzeug: * Restarting with stat +INFO:root:2023-07-16 21:01:46.470883 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2023-07-16 21:01:46.470883 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2023-07-16 21:01:46.470883 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2023-07-16 21:01:46.470883 : ++ FLASK PORT 5001 ++ +INFO:root:2023-07-16 21:01:46.470883 : ++ LMS_BAS_URL mysy-training.com/ ++ +INFO:apscheduler.scheduler:Adding job tentatively -- it will be properly scheduled when the scheduler starts +INFO:apscheduler.scheduler:Added job "Flask_Cron_Strip_Get_Customer_Abonnement_Data" to job store "default" +INFO:apscheduler.scheduler:Scheduler started +DEBUG:apscheduler.scheduler:Looking for jobs to run +DEBUG:apscheduler.scheduler:Next wakeup is due at 2023-07-16 21:06:46.543142+02:00 (in 299.997003 seconds) +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 108-554-791 +INFO:apscheduler.scheduler:Scheduler has been shut down +DEBUG:apscheduler.scheduler:Looking for jobs to run +DEBUG:apscheduler.scheduler:No jobs; waiting until a job is added +INFO:apscheduler.scheduler:Scheduler has been shut down +DEBUG:apscheduler.scheduler:Looking for jobs to run +DEBUG:apscheduler.scheduler:No jobs; waiting until a job is added +INFO:root:2023-07-16 22:49:55.490112 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2023-07-16 22:49:55.490112 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2023-07-16 22:49:55.490112 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2023-07-16 22:49:55.490112 : ++ FLASK PORT 5001 ++ +INFO:root:2023-07-16 22:49:55.490112 : ++ LMS_BAS_URL mysy-training.com/ ++ +INFO:apscheduler.scheduler:Adding job tentatively -- it will be properly scheduled when the scheduler starts +INFO:apscheduler.scheduler:Added job "Flask_Cron_Strip_Get_Customer_Abonnement_Data" to job store "default" +INFO:apscheduler.scheduler:Scheduler started +DEBUG:apscheduler.scheduler:Looking for jobs to run +DEBUG:apscheduler.scheduler:Next wakeup is due at 2023-07-16 22:54:55.647488+02:00 (in 299.996982 seconds) +INFO:werkzeug:WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. + * Running on http://localhost:5001 +INFO:werkzeug:Press CTRL+C to quit +INFO:werkzeug: * Restarting with stat +INFO:root:2023-07-16 22:50:06.396600 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2023-07-16 22:50:06.396600 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2023-07-16 22:50:06.396600 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2023-07-16 22:50:06.396600 : ++ FLASK PORT 5001 ++ +INFO:root:2023-07-16 22:50:06.396600 : ++ LMS_BAS_URL mysy-training.com/ ++ +INFO:apscheduler.scheduler:Adding job tentatively -- it will be properly scheduled when the scheduler starts +INFO:apscheduler.scheduler:Added job "Flask_Cron_Strip_Get_Customer_Abonnement_Data" to job store "default" +INFO:apscheduler.scheduler:Scheduler started +DEBUG:apscheduler.scheduler:Looking for jobs to run +DEBUG:apscheduler.scheduler:Next wakeup is due at 2023-07-16 22:55:06.496378+02:00 (in 299.996999 seconds) +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 632-522-489 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\partner_client.py', reloading +INFO:apscheduler.scheduler:Scheduler has been shut down +DEBUG:apscheduler.scheduler:Looking for jobs to run +DEBUG:apscheduler.scheduler:No jobs; waiting until a job is added +INFO:werkzeug: * Restarting with stat +INFO:root:2023-07-16 22:51:12.588292 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2023-07-16 22:51:12.588292 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2023-07-16 22:51:12.588292 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2023-07-16 22:51:12.588292 : ++ FLASK PORT 5001 ++ +INFO:root:2023-07-16 22:51:12.588292 : ++ LMS_BAS_URL mysy-training.com/ ++ +INFO:apscheduler.scheduler:Adding job tentatively -- it will be properly scheduled when the scheduler starts +INFO:apscheduler.scheduler:Added job "Flask_Cron_Strip_Get_Customer_Abonnement_Data" to job store "default" +INFO:apscheduler.scheduler:Scheduler started +DEBUG:apscheduler.scheduler:Looking for jobs to run +DEBUG:apscheduler.scheduler:Next wakeup is due at 2023-07-16 22:56:12.652436+02:00 (in 299.997938 seconds) +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 632-522-489 +DEBUG:apscheduler.scheduler:Looking for jobs to run +INFO:apscheduler.executors.default:Running job "Flask_Cron_Strip_Get_Customer_Abonnement_Data (trigger: interval[0:05:00], next run at: 2023-07-16 22:54:55 CEST)" (scheduled at 2023-07-16 22:54:55.647488+02:00) +DEBUG:apscheduler.scheduler:Next wakeup is due at 2023-07-16 22:59:55.647488+02:00 (in 299.990981 seconds) +INFO:root:2023-07-16 22:54:55.665348 : dimanche, 16. juillet 2023 10:54:55 : Envoie des données de prefacturation : - 0 clients ==> A traiter. - 0 clients==> traiter OKK. - 0 clients ==> traiter ERREUR. +ERROR:apscheduler.executors.default:Job "Flask_Cron_Strip_Get_Customer_Abonnement_Data (trigger: interval[0:05:00], next run at: 2023-07-16 22:59:55 CEST)" raised an exception +Traceback (most recent call last): + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\apscheduler\executors\base.py", line 125, in run_job + retval = job.func(*job.args, **job.kwargs) + File "C:\Users\billa\Documents\myclass.com\Siteweb\Production\Ela_back\Back_Office\main.py", line 3125, in Flask_Cron_Strip_Get_Customer_Abonnement_Data + return jsonify(status=localStatus, message=message) + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\json\__init__.py", line 342, in jsonify + return current_app.json.response(*args, **kwargs) + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\werkzeug\local.py", line 316, in __get__ + obj = instance._get_current_object() + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\werkzeug\local.py", line 513, in _get_current_object + raise RuntimeError(unbound_message) from None +RuntimeError: Working outside of application context. + +This typically means that you attempted to use functionality that needed +the current application. To solve this, set up an application context +with app.app_context(). See the documentation for more information. +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\partner_client.py', reloading +INFO:apscheduler.scheduler:Scheduler has been shut down +DEBUG:apscheduler.scheduler:Looking for jobs to run +DEBUG:apscheduler.scheduler:No jobs; waiting until a job is added +INFO:werkzeug: * Restarting with stat +INFO:root:2023-07-16 22:55:45.523235 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2023-07-16 22:55:45.524236 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2023-07-16 22:55:45.524236 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2023-07-16 22:55:45.524236 : ++ FLASK PORT 5001 ++ +INFO:root:2023-07-16 22:55:45.524236 : ++ LMS_BAS_URL mysy-training.com/ ++ +INFO:apscheduler.scheduler:Adding job tentatively -- it will be properly scheduled when the scheduler starts +INFO:apscheduler.scheduler:Added job "Flask_Cron_Strip_Get_Customer_Abonnement_Data" to job store "default" +INFO:apscheduler.scheduler:Scheduler started +DEBUG:apscheduler.scheduler:Looking for jobs to run +DEBUG:apscheduler.scheduler:Next wakeup is due at 2023-07-16 23:00:45.585435+02:00 (in 299.997527 seconds) +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 632-522-489 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\partner_client.py', reloading +INFO:apscheduler.scheduler:Scheduler has been shut down +DEBUG:apscheduler.scheduler:Looking for jobs to run +DEBUG:apscheduler.scheduler:No jobs; waiting until a job is added +INFO:werkzeug: * Restarting with stat +INFO:root:2023-07-16 22:59:53.813767 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2023-07-16 22:59:53.813767 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2023-07-16 22:59:53.813767 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2023-07-16 22:59:53.813767 : ++ FLASK PORT 5001 ++ +INFO:root:2023-07-16 22:59:53.813767 : ++ LMS_BAS_URL mysy-training.com/ ++ +INFO:apscheduler.scheduler:Adding job tentatively -- it will be properly scheduled when the scheduler starts +INFO:apscheduler.scheduler:Added job "Flask_Cron_Strip_Get_Customer_Abonnement_Data" to job store "default" +INFO:apscheduler.scheduler:Scheduler started +DEBUG:apscheduler.scheduler:Looking for jobs to run +DEBUG:apscheduler.scheduler:Next wakeup is due at 2023-07-16 23:04:53.887847+02:00 (in 299.996890 seconds) +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 632-522-489 +DEBUG:apscheduler.scheduler:Looking for jobs to run +DEBUG:apscheduler.scheduler:Next wakeup is due at 2023-07-16 23:04:55.647488+02:00 (in 299.982169 seconds) +INFO:apscheduler.executors.default:Running job "Flask_Cron_Strip_Get_Customer_Abonnement_Data (trigger: interval[0:05:00], next run at: 2023-07-16 23:04:55 CEST)" (scheduled at 2023-07-16 22:59:55.647488+02:00) +INFO:root:2023-07-16 22:59:55.669292 : dimanche, 16. juillet 2023 10:59:55 : Envoie des données de prefacturation : - 0 clients ==> A traiter. - 0 clients==> traiter OKK. - 0 clients ==> traiter ERREUR. +ERROR:apscheduler.executors.default:Job "Flask_Cron_Strip_Get_Customer_Abonnement_Data (trigger: interval[0:05:00], next run at: 2023-07-16 23:04:55 CEST)" raised an exception +Traceback (most recent call last): + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\apscheduler\executors\base.py", line 125, in run_job + retval = job.func(*job.args, **job.kwargs) + File "C:\Users\billa\Documents\myclass.com\Siteweb\Production\Ela_back\Back_Office\main.py", line 3125, in Flask_Cron_Strip_Get_Customer_Abonnement_Data + return jsonify(status=localStatus, message=message) + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\json\__init__.py", line 342, in jsonify + return current_app.json.response(*args, **kwargs) + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\werkzeug\local.py", line 316, in __get__ + obj = instance._get_current_object() + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\werkzeug\local.py", line 513, in _get_current_object + raise RuntimeError(unbound_message) from None +RuntimeError: Working outside of application context. + +This typically means that you attempted to use functionality that needed +the current application. To solve this, set up an application context +with app.app_context(). See the documentation for more information. +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\partner_client.py', reloading +INFO:apscheduler.scheduler:Scheduler has been shut down +DEBUG:apscheduler.scheduler:Looking for jobs to run +DEBUG:apscheduler.scheduler:No jobs; waiting until a job is added +INFO:werkzeug: * Restarting with stat +INFO:root:2023-07-16 23:00:11.483428 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2023-07-16 23:00:11.483428 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2023-07-16 23:00:11.484834 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2023-07-16 23:00:11.484834 : ++ FLASK PORT 5001 ++ +INFO:root:2023-07-16 23:00:11.484834 : ++ LMS_BAS_URL mysy-training.com/ ++ +INFO:apscheduler.scheduler:Adding job tentatively -- it will be properly scheduled when the scheduler starts +INFO:apscheduler.scheduler:Added job "Flask_Cron_Strip_Get_Customer_Abonnement_Data" to job store "default" +INFO:apscheduler.scheduler:Scheduler started +DEBUG:apscheduler.scheduler:Looking for jobs to run +DEBUG:apscheduler.scheduler:Next wakeup is due at 2023-07-16 23:05:11.546089+02:00 (in 299.997001 seconds) +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 632-522-489 +DEBUG:apscheduler.scheduler:Looking for jobs to run +DEBUG:apscheduler.scheduler:Next wakeup is due at 2023-07-16 23:09:55.647488+02:00 (in 299.994920 seconds) +INFO:apscheduler.executors.default:Running job "Flask_Cron_Strip_Get_Customer_Abonnement_Data (trigger: interval[0:05:00], next run at: 2023-07-16 23:09:55 CEST)" (scheduled at 2023-07-16 23:04:55.647488+02:00) +INFO:root:2023-07-16 23:04:55.655111 : dimanche, 16. juillet 2023 11:04:55 : Envoie des données de prefacturation : - 0 clients ==> A traiter. - 0 clients==> traiter OKK. - 0 clients ==> traiter ERREUR. +ERROR:apscheduler.executors.default:Job "Flask_Cron_Strip_Get_Customer_Abonnement_Data (trigger: interval[0:05:00], next run at: 2023-07-16 23:09:55 CEST)" raised an exception +Traceback (most recent call last): + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\apscheduler\executors\base.py", line 125, in run_job + retval = job.func(*job.args, **job.kwargs) + File "C:\Users\billa\Documents\myclass.com\Siteweb\Production\Ela_back\Back_Office\main.py", line 3125, in Flask_Cron_Strip_Get_Customer_Abonnement_Data + return jsonify(status=localStatus, message=message) + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\json\__init__.py", line 342, in jsonify + return current_app.json.response(*args, **kwargs) + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\werkzeug\local.py", line 316, in __get__ + obj = instance._get_current_object() + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\werkzeug\local.py", line 513, in _get_current_object + raise RuntimeError(unbound_message) from None +RuntimeError: Working outside of application context. + +This typically means that you attempted to use functionality that needed +the current application. To solve this, set up an application context +with app.app_context(). See the documentation for more information. +DEBUG:apscheduler.scheduler:Looking for jobs to run +INFO:apscheduler.executors.default:Running job "Flask_Cron_Strip_Get_Customer_Abonnement_Data (trigger: interval[0:05:00], next run at: 2023-07-16 23:05:11 CEST)" (scheduled at 2023-07-16 23:05:11.546089+02:00) +DEBUG:apscheduler.scheduler:Next wakeup is due at 2023-07-16 23:10:11.546089+02:00 (in 299.992357 seconds) +INFO:root:2023-07-16 23:05:11.561878 : dimanche, 16. juillet 2023 11:05:11 : Envoie des données de prefacturation : - 0 clients ==> A traiter. - 0 clients==> traiter OKK. - 0 clients ==> traiter ERREUR. +ERROR:apscheduler.executors.default:Job "Flask_Cron_Strip_Get_Customer_Abonnement_Data (trigger: interval[0:05:00], next run at: 2023-07-16 23:10:11 CEST)" raised an exception +Traceback (most recent call last): + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\apscheduler\executors\base.py", line 125, in run_job + retval = job.func(*job.args, **job.kwargs) + File "C:\Users\billa\Documents\myclass.com\Siteweb\Production\Ela_back\Back_Office\main.py", line 3125, in Flask_Cron_Strip_Get_Customer_Abonnement_Data + return jsonify(status=localStatus, message=message) + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\json\__init__.py", line 342, in jsonify + return current_app.json.response(*args, **kwargs) + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\werkzeug\local.py", line 316, in __get__ + obj = instance._get_current_object() + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\werkzeug\local.py", line 513, in _get_current_object + raise RuntimeError(unbound_message) from None +RuntimeError: Working outside of application context. + +This typically means that you attempted to use functionality that needed +the current application. To solve this, set up an application context +with app.app_context(). See the documentation for more information. +DEBUG:apscheduler.scheduler:Looking for jobs to run +DEBUG:apscheduler.scheduler:Next wakeup is due at 2023-07-16 23:14:55.647488+02:00 (in 299.986485 seconds) +INFO:apscheduler.executors.default:Running job "Flask_Cron_Strip_Get_Customer_Abonnement_Data (trigger: interval[0:05:00], next run at: 2023-07-16 23:14:55 CEST)" (scheduled at 2023-07-16 23:09:55.647488+02:00) +INFO:root:2023-07-16 23:09:55.663679 : dimanche, 16. juillet 2023 11:09:55 : Envoie des données de prefacturation : - 0 clients ==> A traiter. - 0 clients==> traiter OKK. - 0 clients ==> traiter ERREUR. +ERROR:apscheduler.executors.default:Job "Flask_Cron_Strip_Get_Customer_Abonnement_Data (trigger: interval[0:05:00], next run at: 2023-07-16 23:14:55 CEST)" raised an exception +Traceback (most recent call last): + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\apscheduler\executors\base.py", line 125, in run_job + retval = job.func(*job.args, **job.kwargs) + File "C:\Users\billa\Documents\myclass.com\Siteweb\Production\Ela_back\Back_Office\main.py", line 3125, in Flask_Cron_Strip_Get_Customer_Abonnement_Data + return jsonify(status=localStatus, message=message) + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\json\__init__.py", line 342, in jsonify + return current_app.json.response(*args, **kwargs) + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\werkzeug\local.py", line 316, in __get__ + obj = instance._get_current_object() + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\werkzeug\local.py", line 513, in _get_current_object + raise RuntimeError(unbound_message) from None +RuntimeError: Working outside of application context. + +This typically means that you attempted to use functionality that needed +the current application. To solve this, set up an application context +with app.app_context(). See the documentation for more information. +DEBUG:apscheduler.scheduler:Looking for jobs to run +DEBUG:apscheduler.scheduler:Next wakeup is due at 2023-07-16 23:15:11.546089+02:00 (in 299.992321 seconds) +INFO:apscheduler.executors.default:Running job "Flask_Cron_Strip_Get_Customer_Abonnement_Data (trigger: interval[0:05:00], next run at: 2023-07-16 23:15:11 CEST)" (scheduled at 2023-07-16 23:10:11.546089+02:00) +INFO:root:2023-07-16 23:10:11.557106 : dimanche, 16. juillet 2023 11:10:11 : Envoie des données de prefacturation : - 0 clients ==> A traiter. - 0 clients==> traiter OKK. - 0 clients ==> traiter ERREUR. +ERROR:apscheduler.executors.default:Job "Flask_Cron_Strip_Get_Customer_Abonnement_Data (trigger: interval[0:05:00], next run at: 2023-07-16 23:15:11 CEST)" raised an exception +Traceback (most recent call last): + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\apscheduler\executors\base.py", line 125, in run_job + retval = job.func(*job.args, **job.kwargs) + File "C:\Users\billa\Documents\myclass.com\Siteweb\Production\Ela_back\Back_Office\main.py", line 3125, in Flask_Cron_Strip_Get_Customer_Abonnement_Data + return jsonify(status=localStatus, message=message) + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\json\__init__.py", line 342, in jsonify + return current_app.json.response(*args, **kwargs) + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\werkzeug\local.py", line 316, in __get__ + obj = instance._get_current_object() + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\werkzeug\local.py", line 513, in _get_current_object + raise RuntimeError(unbound_message) from None +RuntimeError: Working outside of application context. + +This typically means that you attempted to use functionality that needed +the current application. To solve this, set up an application context +with app.app_context(). See the documentation for more information. +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\partner_client.py', reloading +INFO:apscheduler.scheduler:Scheduler has been shut down +DEBUG:apscheduler.scheduler:Looking for jobs to run +DEBUG:apscheduler.scheduler:No jobs; waiting until a job is added +INFO:werkzeug: * Restarting with stat +INFO:root:2023-07-16 23:14:39.378543 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2023-07-16 23:14:39.379585 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2023-07-16 23:14:39.379585 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2023-07-16 23:14:39.379585 : ++ FLASK PORT 5001 ++ +INFO:root:2023-07-16 23:14:39.379585 : ++ LMS_BAS_URL mysy-training.com/ ++ +INFO:apscheduler.scheduler:Adding job tentatively -- it will be properly scheduled when the scheduler starts +INFO:apscheduler.scheduler:Added job "Flask_Cron_Strip_Get_Customer_Abonnement_Data" to job store "default" +INFO:apscheduler.scheduler:Scheduler started +DEBUG:apscheduler.scheduler:Looking for jobs to run +DEBUG:apscheduler.scheduler:Next wakeup is due at 2023-07-16 23:19:39.456958+02:00 (in 299.997964 seconds) +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 632-522-489 +DEBUG:apscheduler.scheduler:Looking for jobs to run +DEBUG:apscheduler.scheduler:Next wakeup is due at 2023-07-16 23:19:55.647488+02:00 (in 299.982194 seconds) +INFO:apscheduler.executors.default:Running job "Flask_Cron_Strip_Get_Customer_Abonnement_Data (trigger: interval[0:05:00], next run at: 2023-07-16 23:19:55 CEST)" (scheduled at 2023-07-16 23:14:55.647488+02:00) +INFO:root:2023-07-16 23:14:55.668348 : dimanche, 16. juillet 2023 11:14:55 : Envoie des données de prefacturation : - 0 clients ==> A traiter. - 0 clients==> traiter OKK. - 0 clients ==> traiter ERREUR. +ERROR:apscheduler.executors.default:Job "Flask_Cron_Strip_Get_Customer_Abonnement_Data (trigger: interval[0:05:00], next run at: 2023-07-16 23:19:55 CEST)" raised an exception +Traceback (most recent call last): + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\apscheduler\executors\base.py", line 125, in run_job + retval = job.func(*job.args, **job.kwargs) + File "C:\Users\billa\Documents\myclass.com\Siteweb\Production\Ela_back\Back_Office\main.py", line 3125, in Flask_Cron_Strip_Get_Customer_Abonnement_Data + return jsonify(status=localStatus, message=message) + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\json\__init__.py", line 342, in jsonify + return current_app.json.response(*args, **kwargs) + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\werkzeug\local.py", line 316, in __get__ + obj = instance._get_current_object() + File "C:\Users\billa\AppData\Local\Programs\Python\Python310\lib\site-packages\werkzeug\local.py", line 513, in _get_current_object + raise RuntimeError(unbound_message) from None +RuntimeError: Working outside of application context. + +This typically means that you attempted to use functionality that needed +the current application. To solve this, set up an application context +with app.app_context(). See the documentation for more information. diff --git a/partner_client.py b/partner_client.py index e1ff826..3e0d4e7 100644 --- a/partner_client.py +++ b/partner_client.py @@ -87,13 +87,12 @@ def Add_Partner_Client(diction): """ qry = {'nom': str(diction['nom']), 'valide': '1', 'partner_recid': str(my_partner['recid'])} - print(" ### qry = ", qry) tmp_count = MYSY_GV.dbname['partner_client'].count_documents(qry) if (tmp_count > 0): mycommon.myprint( str(inspect.stack()[0][ - 3]) + " - Cet appel d'offre est deja enregistré : nom = ", str(diction['nom'])) + 3]) + " - Il existe déjà un client qui porte le même nom = ", str(diction['nom'])) return False, " - Il existe déjà un client qui porte le même nom " @@ -102,7 +101,7 @@ def Add_Partner_Client(diction): if (tmp_count > 0): mycommon.myprint( str(inspect.stack()[0][ - 3]) + " - Cet appel d'offre est deja enregistré : email = ", str(diction['email'])) + 3]) + " - Il existe déjà un client qui porte le même email principal = ", str(diction['email'])) return False, " - Il existe déjà un client qui porte le même email principal " @@ -161,6 +160,18 @@ def Add_Partner_Client(diction): if diction['address']: address = ast.literal_eval(diction['address']) data['address'] = ast.literal_eval(diction['address']) + """" + /!\ : l'adresse etant directement enregistrée sur le client, alors verification que le ligne "adresse" contient bien les champs : + - adresse, code postal, ville, pays + """ + + adresse_field_list_obligatoire = ['adresse', "code_postal", "ville", "pays", ] + for val in adresse_field_list_obligatoire: + if val not in address.keys(): + mycommon.myprint( + str(inspect.stack()[0][3]) + " - Le champ '" + val + "' est obligatoire dans l'adresse") + return False, " Le champ '" + val + "' est obligatoire dans l'adresse", + invoice_address = {} if ("invoice_address" in diction.keys()): @@ -168,29 +179,40 @@ def Add_Partner_Client(diction): invoice_address = ast.literal_eval(diction['invoice_address']) data['invoice_address'] = ast.literal_eval(diction['invoice_address']) + """" + verification que le ligne "adresse de facturation" contient bien les champs : + - adresse, code postal, ville, pays + """ + + adresse_field_list_obligatoire = ['adresse', "code_postal", "ville", "pays", ] + for val in adresse_field_list_obligatoire: + if val not in invoice_address.keys(): + mycommon.myprint( + str(inspect.stack()[0][3]) + " - Le champ '" + val + "' est obligatoire dans l'adresse de facturation") + return False, " Le champ '" + val + "' est obligatoire dans l'adresse de facturation", + list_contact = "" if ("list_contact" in diction.keys()): if diction['list_contact']: list_contact = diction['list_contact'] data['list_contact'] = diction['list_contact'] + data['valide'] = '1' + data['locked'] = '0' + data['date_update'] = str(datetime.now()) - """" - /!\ : l'adresse etant directement enregistrée sur le client, alors verification que le ligne "adresse" contient bien les champs : - - adresse, code postal, ville, pays - """ + # Creation du RecId + data['recid'] = mycommon.create_user_recid() - adresse_field_list_obligatoire = ['adresse', "code_postal", "ville", "pays", ] - for val in adresse_field_list_obligatoire: - if val not in address.keys(): - mycommon.myprint( - str(inspect.stack()[0][3]) + " - Le champ '" + val + "' est obligatoire dans l'adresse") - return False, " Le champ '" + val + "' est obligatoire dans l'adresse", + inserted_id = "" + inserted_id = MYSY_GV.dbname['partner_client'].insert_one(data).inserted_id + if (not inserted_id): + mycommon.myprint( + " Impossible de créer le client du partner ") + return False, " Impossible de créer le client " - print(" les info client à enregistrer : ", str(data)) - return True, " Le client a été correctement créé" except Exception as e: @@ -203,6 +225,164 @@ Mise à jour d'un client """ def Update_Partner_Client(diction): try: + diction = mycommon.strip_dictionary(diction) + + """ + Verification des input acceptés + """ + field_list = ['token', "raison_sociale", "nom", "siret", "tva", "email", + "telephone", "website", "comment", "address", "invoice_address", "list_contact", ] + + incom_keys = diction.keys() + for val in incom_keys: + if val not in field_list: + mycommon.myprint(str( + inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas") + return False, " Les informations fournies sont incorrectes", + + """ + Verification des champs obligatoires + """ + field_list_obligatoire = ['token', "nom", "email", ] + + for val in field_list_obligatoire: + if val not in diction: + mycommon.myprint( + str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ") + return False, " Les informations fournies sont incorrectes", + + """ + Verification de l'identité et autorisation de l'entité qui + appelle cette API + """ + token = "" + if ("token" in diction.keys()): + if diction['token']: + token = diction['token'] + + # Verifier la validité du token + retval = mycommon.check_partner_token_validity("", token) + + if retval is False: + return "Err_Connexion", " La session de connexion n'est pas valide" + + partner_recid = mycommon.get_parnter_recid_from_token(token) + if (partner_recid is False): + mycommon.myprint( + str(inspect.stack()[0][3]) + " - partner_recid est KO. Les données de connexion sont incorrectes ") + return False, " Vous n'etes pas autorisé à utiliser cette API " + + # Recuperation des données du partenaire + local_status, my_partner = mycommon.get_partner_data_from_recid(partner_recid) + if (local_status is False): + mycommon.myprint(str(inspect.stack()[0][3]) + " - impossible de recuperer les données du partenaire") + return False, str(inspect.stack()[0][3]) + " - impossible de recuperer les données du partenaire. " + + """ + Verification s'il n'existe pas un cient du partenaire qui perte le meme + nom, ou la meme adresse email + """ + + qry = {'nom': str(diction['nom']), 'email': str(diction['email']), + 'valide': '1', 'partner_recid': str(my_partner['recid'])} + + tmp_count = MYSY_GV.dbname['partner_client'].count_documents(qry) + if (tmp_count <= 0): + mycommon.myprint( + str(inspect.stack()[0][ + 3]) + " - Ce client n'existe pas: nom = ", str(diction['nom'])) + + return False, " - Ce client n'existe pas " + + + + """ + Recuperation des données fournies en entrée + """ + + data_update = {} + """ + Recuperation des données fournies en entrée + """ + + raison_sociale = "" + if ("raison_sociale" in diction.keys()): + raison_sociale = diction['raison_sociale'] + data_update['raison_sociale'] = diction['raison_sociale'] + + nom = "" + if ("nom" in diction.keys()): + nom = diction['nom'] + data_update['nom'] = diction['nom'] + + siret = "" + if ("siret" in diction.keys()): + siret = diction['siret'] + data_update['siret'] = diction['siret'] + + tva = "" + if ("tva" in diction.keys()): + tva = diction['tva'] + data_update['tva'] = diction['tva'] + + email = "" + if ("email" in diction.keys()): + email = diction['email'] + data_update['email'] = diction['email'] + + website = "" + if ("website" in diction.keys()): + website = diction['website'] + data_update['website'] = diction['website'] + + comment = "" + if ("comment" in diction.keys()): + comment = diction['comment'] + data_update['comment'] = diction['comment'] + + address = {} + if ("address" in diction.keys()): + address = ast.literal_eval(diction['address']) + data_update['address'] = ast.literal_eval(diction['address']) + """" + /!\ : l'adresse etant directement enregistrée sur le client, alors verification que le ligne "adresse" contient bien les champs : + - adresse, code postal, ville, pays + """ + + adresse_field_list_obligatoire = ['adresse', "code_postal", "ville", "pays", ] + for val in adresse_field_list_obligatoire: + if val not in address.keys(): + mycommon.myprint( + str(inspect.stack()[0][3]) + " - Le champ '" + val + "' est obligatoire dans l'adresse") + return False, " Le champ '" + val + "' est obligatoire dans l'adresse", + + invoice_address = {} + if ("invoice_address" in diction.keys()): + invoice_address = ast.literal_eval(diction['invoice_address']) + data_update['invoice_address'] = ast.literal_eval(diction['invoice_address']) + + """" + verification que le ligne "adresse de facturation" contient bien les champs : + - adresse, code postal, ville, pays + """ + + adresse_field_list_obligatoire = ['adresse', "code_postal", "ville", "pays", ] + for val in adresse_field_list_obligatoire: + if val not in invoice_address.keys(): + mycommon.myprint( + str(inspect.stack()[0][ + 3]) + " - Le champ '" + val + "' est obligatoire dans l'adresse de facturation") + return False, " Le champ '" + val + "' est obligatoire dans l'adresse de facturation", + + list_contact = "" + if ("list_contact" in diction.keys()): + list_contact = diction['list_contact'] + data_update['list_contact'] = diction['list_contact'] + + data_update['valide'] = '1' + data_update['locked'] = '0' + data_update['date_update'] = str(datetime.now()) + return True, " Le client a été correctement mise à jour"