Модуль smsactivateru. Ошибка: activation.was_sent().request(wrapper) AttributeError: 'dict' object has no attribute 'request'
Вот код:
import smsactivateru
from smsactivateru import Sms, SmsTypes, SmsService, GetBalance, GetFreeSlots, GetNumber
api = 'мой апи'
wrapper = Sms(api)
balance = GetBalance().request(wrapper)
print('На счету {} руб.'.format(balance))
activation = GetNumber(
service=SmsService().Gmail,
).request(wrapper)
print("+"+str(activation.phone_number))
t.sleep(3)
pyautogui.sleep(3)
###Здесь я уже номер ввёл и код отправил
activation.was_sent().request(wrapper)
code = activation.wait_code(wrapper=wrapper)
print(str(code))
Вот вывод:
На счету 50.0 руб.
+601133138466
Traceback (most recent call last):
File "C:\Users\User\Desktop\python\AI mouse\auto\google.py", line 20, in <module>
activation.was_sent().request(wrapper)
AttributeError: 'dict' object has no attribute 'request'
Ответы (1 шт):
Автор решения: kamazz
→ Ссылка
Я всё сам понял. Вот так всё работает:
import smsactivateru
from smsactivateru import Sms, SmsTypes, SmsService, GetBalance, GetFreeSlots, GetNumber
api = 'мой апи'
wrapper = Sms(api)
balance = GetBalance().request(wrapper)
print('На счету {} руб.'.format(balance))
activation = GetNumber(
service=SmsService().Gmail,
country=SmsTypes.Country.MY
).request(wrapper)
print('id: {} phone: {}'.format(str(activation.id), str(activation.phone_number)))
phoneInput = driver.find_element_by_xpath('//*[@id="phoneNumberId"]')
phoneInput.send_keys("+"+str(activation.phone_number))
print("+"+str(activation.phone_number))
activation.was_sent()
code = activation.wait_code(wrapper=wrapper)
print(str(code))