django-chelseru 2.0.0__tar.gz → 2.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {django_chelseru-2.0.0/django_chelseru.egg-info → django_chelseru-2.0.1}/PKG-INFO +1 -1
- {django_chelseru-2.0.0 → django_chelseru-2.0.1/django_chelseru.egg-info}/PKG-INFO +1 -1
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/services.py +50 -4
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/settings.py +6 -4
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/setup.py +1 -1
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/LICENSE +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/MANIFEST.in +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/README.md +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/README_PA.md +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/django_chelseru.egg-info/SOURCES.txt +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/django_chelseru.egg-info/dependency_links.txt +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/django_chelseru.egg-info/requires.txt +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/django_chelseru.egg-info/top_level.txt +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/__init__.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/admin.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/apps.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/consumers.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/middlewares.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0001_initial.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0002_otpcode_session_user.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0003_rename_mobile_otpcode_mobile_number.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0004_rename_message_message_sms.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0005_rename_message_sms_messagesms_chatroom_messagechat.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0006_alter_chatroom_user_1_alter_chatroom_user_2_and_more.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0007_chatroom_pinned_for_chatroom_status_chatroom_users_and_more.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0008_alter_chatroompermissions_user.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0009_alter_chatroom_status.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0010_chatroom_banneds_chatroom_descriptions_chatroom_name_and_more.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0011_alter_chatroom_user_1_alter_chatroom_user_2.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0012_payment.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0013_payment_authority_payment_data_payment_status_code.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0014_payment_gateway_title_payment_gateway_url.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0015_payment_message.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0016_payment_card_hash_payment_card_pan_and_more.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0017_alter_payment_callback_url_alter_payment_gateway_url.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0018_alter_payment_ref_id.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0019_payment_created_at_payment_status_payment_updated_at.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0020_payment_paid_at.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0021_alter_payment_message.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0022_payment_pay_mode_wallet.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/__init__.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/models.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/routing.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/serializers.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/signals.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/tests.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/urls.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/validators.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/views.py +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/pyproject.toml +0 -0
- {django_chelseru-2.0.0 → django_chelseru-2.0.1}/setup.cfg +0 -0
|
@@ -116,10 +116,37 @@ class KavenegarCom:
|
|
|
116
116
|
|
|
117
117
|
def __init__(self, mobile, options, *args, **kwargs):
|
|
118
118
|
self.RECEIVER = mobile
|
|
119
|
-
if options and 'api_key' in options
|
|
119
|
+
if options and 'api_key' in options:
|
|
120
120
|
self.API_KEY = options['api_key']
|
|
121
|
-
|
|
121
|
+
if 'from' in options:
|
|
122
|
+
self.SENDER = options['from']
|
|
123
|
+
|
|
124
|
+
def send_message_lookup(self, message, template_id, **kwargs):
|
|
125
|
+
try:
|
|
126
|
+
api_url = f'https://api.kavenegar.com/v1/{self.API_KEY}/verify/lookup.json'
|
|
127
|
+
data = {
|
|
128
|
+
'receptor': self.RECEIVER,
|
|
129
|
+
'template': template_id,
|
|
130
|
+
'token': message.strip(),
|
|
131
|
+
}
|
|
132
|
+
if kwargs.get('token2'):
|
|
133
|
+
data['token2'] = kwargs.get('token2').strip()
|
|
134
|
+
|
|
135
|
+
if kwargs.get('token3'):
|
|
136
|
+
data['token3'] = kwargs.get('token3').strip()
|
|
137
|
+
|
|
138
|
+
if kwargs.get('token10'):
|
|
139
|
+
data['token10'] = kwargs.get('token10')
|
|
122
140
|
|
|
141
|
+
if kwargs.get('token20'):
|
|
142
|
+
data['token20'] = kwargs.get('token20')
|
|
143
|
+
|
|
144
|
+
response = requests.post(url=api_url, data=data)
|
|
145
|
+
return response
|
|
146
|
+
|
|
147
|
+
except Exception as e:
|
|
148
|
+
print(str(e))
|
|
149
|
+
return False
|
|
123
150
|
|
|
124
151
|
def send_message(self, message):
|
|
125
152
|
try:
|
|
@@ -148,7 +175,8 @@ class KavenegarCom:
|
|
|
148
175
|
418 Your credit is not sufficient.
|
|
149
176
|
451 Excessive calls within a specific time period are restricted to IP addresses.
|
|
150
177
|
"""
|
|
151
|
-
except:
|
|
178
|
+
except Exception as e:
|
|
179
|
+
print(str(e))
|
|
152
180
|
return False
|
|
153
181
|
|
|
154
182
|
|
|
@@ -213,7 +241,25 @@ def send_message(mobile_number, message_text, data=None, template_id=None):
|
|
|
213
241
|
elif sms_service == 'KAVENEGAR_COM':
|
|
214
242
|
service = KavenegarCom(mobile=mobile_number, options=options)
|
|
215
243
|
try:
|
|
216
|
-
|
|
244
|
+
if template_id or data.get('template_id'):
|
|
245
|
+
if not template_id:
|
|
246
|
+
template_id = data.get('template_id')
|
|
247
|
+
|
|
248
|
+
_data = {}
|
|
249
|
+
if 'token2' in data:
|
|
250
|
+
_data['token2'] = data.get('token2')
|
|
251
|
+
if 'token3' in data:
|
|
252
|
+
_data['token3'] = data.get('token3')
|
|
253
|
+
if 'token10' in data:
|
|
254
|
+
_data['token10'] = data.get('token10')
|
|
255
|
+
if 'token20' in data:
|
|
256
|
+
_data['token20'] = data.get('token20')
|
|
257
|
+
|
|
258
|
+
response = service.send_message_lookup(message=message_text, template_id=template_id, **_data)
|
|
259
|
+
else:
|
|
260
|
+
response = service.send_message(message=message_text)
|
|
261
|
+
|
|
262
|
+
print(response.json())
|
|
217
263
|
response_json = response.json()
|
|
218
264
|
entries = response_json.get('entries', [])
|
|
219
265
|
_return = response_json.get('return', {})
|
|
@@ -187,11 +187,13 @@ def sms_init_check():
|
|
|
187
187
|
options['api_key'] = api_key
|
|
188
188
|
|
|
189
189
|
_from = getattr(settings, SERVICE_NAME).get('SMS').get('SETTINGS').get('KAVENEGAR_COM_FROM')
|
|
190
|
-
if
|
|
191
|
-
raise ImproperlyConfigured(f'KAVENEGAR_COM_FROM must be defined in {SERVICE_NAME}: SMS: SETTINGS, To send an SMS, the sender`s number is required.')
|
|
192
|
-
|
|
193
|
-
else:
|
|
190
|
+
if _from:
|
|
194
191
|
options['from'] = _from
|
|
192
|
+
# if not _from:
|
|
193
|
+
# raise ImproperlyConfigured(f'KAVENEGAR_COM_FROM must be defined in {SERVICE_NAME}: SMS: SETTINGS, To send an SMS, the sender`s number is required.')
|
|
194
|
+
|
|
195
|
+
# else:
|
|
196
|
+
|
|
195
197
|
|
|
196
198
|
return {'SMS_SERVICE': sms_service, 'SETTINGS': options, 'TEMPLATES': templates}
|
|
197
199
|
except ImproperlyConfigured as e:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_chelseru-2.0.0 → django_chelseru-2.0.1}/django_chelseru.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0002_otpcode_session_user.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0009_alter_chatroom_status.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0015_payment_message.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0018_alter_payment_ref_id.py
RENAMED
|
File without changes
|
|
File without changes
|
{django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0020_payment_paid_at.py
RENAMED
|
File without changes
|
{django_chelseru-2.0.0 → django_chelseru-2.0.1}/drfchelseru/migrations/0021_alter_payment_message.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|