Last major update: 25.08.2020
- Что такое авторизация/аутентификация
- Где хранить токены
- Как ставить куки ?
- Процесс логина
- Процесс рефреш токенов
- Кража токенов/Механизм контроля токенов
| def interval_to_milliseconds(interval): | |
| """Convert a Binance interval string to milliseconds | |
| :param interval: Binance interval string 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w | |
| :type interval: str | |
| :return: | |
| None if unit not one of m, h, d or w | |
| None if string not in correct format | |
| int value of interval in milliseconds |
| # requires dateparser package | |
| import dateparser | |
| import pytz | |
| from datetime import datetime | |
| def date_to_milliseconds(date_str): | |
| """Convert UTC date to milliseconds | |
| If using offset strings add "UTC" to date string e.g. "now UTC", "11 hours ago UTC" |
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
| import json | |
| import tornado.web | |
| class JsonHandler(BaseHandler): | |
| """Request handler where requests and responses speak JSON.""" | |
| def prepare(self): | |
| # Incorporate request JSON into arguments dictionary. | |
| if self.request.body: | |
| try: |