OTP مع python
إنشاء رمز OTP (كلمة مرور واحدة) باستخدام python
python : وثائق API
- إنشاء مجموعة باستخدام python
- الحصول على قائمة حقول المجموعة باستخدام python
- إضافة حقل إلى مجموعة بها python
- حذف حقل من مجموعة بها python
- حذف جهة اتصال من مجموعة
- عيّن البلد إلى مجموعة بها python
- الحصول على قائمة جهات اتصال المجموعة باستخدام python
- إضافة جهة اتصال إلى مجموعة بها python
- تعديل جهة اتصال مجموعة بها python
- حذف جهة اتصال لمجموعة بها python
OTP مع python
import urllib2
afilnet_class="otp"
afilnet_method="generateotp"
afilnet_user="user"
afilnet_password="password"
afilnet_type="number"
afilnet_destination="34600000000"
afilnet_time="1"
afilnet_timetype="days"
afilnet_length="6"
afilnet_otpformat="all"
afilnet_output=""
# Create an URL request
sUrl = "https://www.afilnet.com/api/http/?class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&type="+afilnet_type+"&destination="+afilnet_destination+"&time="+afilnet_time+"&timetype="+afilnet_timetype+"&length="+afilnet_length+"&otpformat="+afilnet_otpformat+"&output="+afilnet_output
result = urllib2.urlopen(sUrl).read()
from urllib.request import urlopen
from urllib.parse import urlencode
afilnet_class="otp"
afilnet_method="generateotp"
afilnet_user="user"
afilnet_password="password"
afilnet_type="number"
afilnet_destination="34600000000"
afilnet_time="1"
afilnet_timetype="days"
afilnet_length="6"
afilnet_otpformat="all"
afilnet_output=""
# Create an URL request
sUrl = "https://www.afilnet.com/api/http/"
data = urlencode({"class": afilnet_class,"method": afilnet_method,"user": afilnet_user,"password": afilnet_password,"type": afilnet_type,"destination": afilnet_destination,"time": afilnet_time,"timetype": afilnet_timetype,"length": afilnet_length,"otpformat": afilnet_otpformat,"output": afilnet_output}).encode("utf-8")
result = urlopen(sUrl, data).read()
print(result)
import requests
afilnet_class="otp"
afilnet_method="generateotp"
afilnet_user="user"
afilnet_password="password"
afilnet_type="number"
afilnet_destination="34600000000"
afilnet_time="1"
afilnet_timetype="days"
afilnet_length="6"
afilnet_otpformat="all"
afilnet_output=""
# Create an URL request
sUrl = "https://www.afilnet.com/api/basic/?class="+afilnet_class+"&method="+afilnet_method+"&type="+afilnet_type+"&destination="+afilnet_destination+"&time="+afilnet_time+"&timetype="+afilnet_timetype+"&length="+afilnet_length+"&otpformat="+afilnet_otpformat+"&output="+afilnet_output
result = requests.get(sUrl,auth=requests.auth.HTTPBasicAuth(afilnet_user,afilnet_password))
print(result.text)
معامل | وصف | إجباري / اختياري |
---|---|---|
class=otp | الفئة المطلوبة: الفئة التي تم تقديم الطلب إليها | إلزامي |
method=generateotp | طريقة الفصل المطلوبة: طريقة الفصل الذي تم تقديم الطلب إليه | إلزامي |
user | المستخدم والبريد الإلكتروني لحساب Afilnet الخاص بك | إلزامي |
password | كلمة المرور لحساب Afilnet الخاص بك | إلزامي |
type | نوع المجموعة (البريد الإلكتروني أو المحمول) | إلزامي |
destination | رقم الجوال أو البريد الإلكتروني للوجهة | إلزامي |
time | عدد الأيام أو الأسابيع أو الأشهر أو السنوات | اختياري |
timetype | نوع الوقت (القيمة الممكنة: الأيام والأسابيع والشهور والسنوات) | اختياري |
length | طول كلمة المرور لتوليد | اختياري |
otpformat | تنسيق كلمة المرور المراد إنشاؤها ، إذا كانت تتضمن جميع الأحرف ، الأرقام فقط أو الحروف فقط (الكل ، الأرقام ، الحروف) | اختياري |
output | تنسيق الإخراج من النتيجة | اختياري |
عند تقديم طلبات ، ستتلقى الحقول التالية:
- status
-
النتيجة (إذا كانت الحالة = النجاح) ، سوف تتلقى هنا القيم التالية:
- لن يتم إرسال قيم إضافية إليك
- خطأ (إذا كانت الحالة = خطأ) ، هنا ستتلقى رمز الخطأ
يتم سرد رموز الأخطاء المحتملة أدناه
الشفرة | وصف |
---|---|
MISSING_USER | المستخدم أو البريد الإلكتروني غير المدرجة |
MISSING_PASSWORD | كلمة المرور غير المدرجة |
MISSING_CLASS | الطبقة غير المدرجة |
MISSING_METHOD | طريقة غير المدرجة |
MISSING_COMPULSORY_PARAM | المعلمة الإجبارية غير المدرجة |
INCORRECT_USER_PASSWORD | مستخدم غير صحيح أو كلمة المرور |
INCORRECT_CLASS | فئة غير صحيحة |
INCORRECT_METHOD | طريقة غير صحيحة |
INCORRECT_TIME_TYPE | نوع الوقت غير صحيح (القيم المحتملة: الأيام أو الأسابيع أو الأشهر أو السنوات) |
INCORRECT_TYPE | نوع غير صحيح. يجب أن يكون النوع المحمول أو البريد الإلكتروني |
INCORRECT_FORMAT | ERROR_INCORRECT_FORMAT |
INCORRECT_OTP_FORMAT | ERROR_INCORRECT_OTP_FORMAT |
المعلمات:
- class : otp
- method : generateotp
- user : user
- password : password
- type : number
- destination : 34600000000
- time : 1
- timetype : days
- length : 6
- otpformat : all
- output :
طلب:
https://www.afilnet.com/api/http/?class=otp&method=generateotp&user=user&password=password&type=number&destination=34600000000&time=1&timetype=days&length=6&otpformat=all&output=