N
N
Nodir Malikov2021-01-26 10:57:34
Python
Nodir Malikov, 2021-01-26 10:57:34

What error can I get when making a POST request?

I want to send sms to my phone using my sms provider's API, but I couldn't find any documentation for it.
At the request, I seem to have correctly specified the parameters, but an error occurs that the "text" parameter is not set

def sendSMS(tel):
    tel = int(re.search(r'\d+', tel).group())  # tel without +
    URL_SMS = "https://information.mobitel.uz/admin/api"
    API_SMS = "XrAZ_2kMwbxFGUxHj8RpeisKNIVyxxxx"
    headers_sms = {"LOGIN_SMS": "orient", "PSW_SMS": "Uq5z5dfb"}
    sms_code = randint(1000, 9999)
    random = "Code: " + str(sms_code)
    data_sms = {"key": API_SMS, "phone": tel, "text": "hello"}
    send = requests.post(URL_SMS, json=data_sms)
    responseData = send.json()
    print(random)
    print(json.dumps(responseData, indent=4, sort_keys=True, ensure_ascii=False))
    return "test"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexandr M., 2021-02-04
@Makarych90

Is there a requirement for a minimum line length? less than 6 characters means an empty string. It sounds crazy, of course, but on the other hand, what to expect from a provider that does not document API functions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question