OTP z Python
Wygeneruj token OTP (jednorazowe hasło) za pomocą Python
Python : DOKUMENTACJA API
- Utwórz grupę za pomocą Python
- Uzyskaj listę pól grupy za pomocą Python
- Dodaj pole do grupy za pomocą Python
- Usuń pole z grupy za pomocą Python
- Usuń kontakt z grupy
- Pomoc krajowi w grupie z Python
- Uzyskaj listę kontaktów grupy za pomocą Python
- Dodaj kontakt do grupy za pomocą Python
- Zmodyfikuj kontakt grupy za pomocą Python
- Usuń kontakt grupy za pomocą Python
OTP z 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)
Parametr | Opis | Obowiązkowe / opcjonalne |
---|---|---|
class=otp | Klasa wymagana: klasa, do której kierowane jest żądanie | Obowiązkowe |
method=generateotp | Żądana metoda klasy: metoda klasy, do której kierowane jest żądanie | Obowiązkowe |
user | Użytkownik i adres e-mail Twojego konta Afilnet | Obowiązkowe |
password | Hasło do konta Afilnet | Obowiązkowe |
type | Rodzaj grupy (e-mail lub telefon komórkowy) | Obowiązkowe |
destination | Numer telefonu komórkowego lub docelowy adres e-mail | Obowiązkowe |
time | Liczba dni, tygodni, miesięcy lub lat | Opcjonalnie |
timetype | Rodzaj czasu (możliwa wartość: dni, tygodnie, miesiące w latach) | Opcjonalnie |
length | Długość hasła do wygenerowania | Opcjonalnie |
otpformat | Format hasła do wygenerowania, jeśli zawiera wszystkie znaki, tylko cyfry lub tylko litery (wszystkie, cyfry, litery) | Opcjonalnie |
output | Format wyjściowy wyniku | Opcjonalnie |
Kiedy będziesz składać wnioski, otrzymasz następujące pola:
- status
-
wynik (jeśli status = sukces), tutaj otrzymasz następujące wartości:
- Żadne dodatkowe wartości nie zostaną do Ciebie wysłane
- error (if status = error), tutaj otrzymasz kod błędu
Możliwe kody błędów są wymienione poniżej
Kod | Opis |
---|---|
MISSING_USER | Użytkownik lub adres e-mail nie są uwzględnione |
MISSING_PASSWORD | Hasło nie jest wliczone |
MISSING_CLASS | Klasa nie jest wliczona |
MISSING_METHOD | Metoda nie jest uwzględniona |
MISSING_COMPULSORY_PARAM | Obowiązkowy parametr nie jest uwzględniony |
INCORRECT_USER_PASSWORD | Niepoprawny użytkownik lub hasło |
INCORRECT_CLASS | Niepoprawna klasa |
INCORRECT_METHOD | Niepoprawna metoda |
INCORRECT_TIME_TYPE | Niepoprawny rodzaj czasu (możliwe wartości: dni, tygodnie, miesiące lub lata) |
INCORRECT_TYPE | Niepoprawny typ. Typ musi być mobilny lub e-mailem |
INCORRECT_FORMAT | ERROR_INCORRECT_FORMAT |
INCORRECT_OTP_FORMAT | ERROR_INCORRECT_OTP_FORMAT |
Parametry:
- class : otp
- method : generateotp
- user : user
- password : password
- type : number
- destination : 34600000000
- time : 1
- timetype : days
- length : 6
- otpformat : all
- output :
Zapytanie:
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=