# Celery beat
app.conf.beat_schedule = {
'scheduled': {
'task': 'api.controllers.message.scheduled_message',
'schedule': 60.0
}
}
app.conf.timezone = 'UTC'
# scheduled_message оборачиваем в обычный task
@task()
def scheduled_message():
pass
from requests_toolbelt.multipart.encoder import MultipartEncoder
m = MultipartEncoder(
fields=dict(
access_token=user.fb_token,
upload_phase='transfer',
start_offset=kwargs.get('start_offset'),
upload_session_id=kwargs.get('upload_session_id'),
video_file_chunk=('chunk1.mp4', open(video_file_chunk, 'rb'),
'multipart-form/data'),
)
)
url = '%s%s/videos' % (self.api_video, user.fb_user_id)
req = requests.post(url=url, data=m, headers={'Content-Type': m.content_type})
mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+--------+
| Variable_name | Value |
+--------------------------------------+--------+
| validate_password_check_user_name | OFF |
| validate_password_dictionary_file | |
| validate_password_length | 8 |
| validate_password_mixed_case_count | 1 |
| validate_password_number_count | 1 |
| validate_password_policy | MEDIUM |
| validate_password_special_char_count | 1 |
+--------------------------------------+--------+
7 rows in set (0,23 sec)
mysql> SET GLOBAL validate_password_length = 0;
Query OK, 0 rows affected (0,00 sec)
mysql> SET GLOBAL validate_password_mixed_case_count = 0;
Query OK, 0 rows affected (0,00 sec)
mysql> SET GLOBAL validate_password_number_count = 0;
Query OK, 0 rows affected (0,00 sec)
mysql> SET GLOBAL validate_password_special_char_count = 0;
Query OK, 0 rows affected (0,00 sec)
mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+-------+
| Variable_name | Value |
+--------------------------------------+-------+
| validate_password_check_user_name | OFF |
| validate_password_dictionary_file | |
| validate_password_length | 4 |
| validate_password_mixed_case_count | 0 |
| validate_password_number_count | 0 |
| validate_password_policy | LOW |
| validate_password_special_char_count | 0 |
+--------------------------------------+-------+
7 rows in set (0,01 sec)
import threading
import time
def example(name ,event):
i = 0
while event.is_set():
print('Thread: %s, %d', % (t1.name, i))
i += 1
time.sleep(10)
try:
event = threading.Event()
event.set()
t1 = threading.Thread(target=example, args=('first', event))
t1.start()
except KeyboardInterrupt:
event.clear()
t1.join()