-
-
Notifications
You must be signed in to change notification settings - Fork 449
/
Copy pathfake.py
35 lines (30 loc) · 1.03 KB
/
fake.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import logging
logger = logging.getLogger(__name__)
class Fake:
"""
Prints the tokens to the logger. You will have to set the message level of
the ``two_factor`` logger to ``INFO`` for them to appear in the console.
Useful for local development. You should configure your logging like this::
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
},
},
'loggers': {
'two_factor': {
'handlers': ['console'],
'level': 'INFO',
}
}
}
"""
@staticmethod
def make_call(device, token):
logger.info('Fake call to %s: "Your token is: %s"', device.number.as_e164, token)
@staticmethod
def send_sms(device, token):
logger.info('Fake SMS to %s: "Your token is: %s"', device.number.as_e164, token)