Прошу помощи в отправке post-запроса в форму на сайте c помощью python и библиотеки requests. Форма имеет следующий вид:
<form action="" method="post" name="blank" onsubmit="return true;" enctype="multipart/form-data">
<input multiple="multiple" type="file" class="userfile" name="file" id="userfile" title="">
<input type="submit" value="send" name="submit">
</form>
С помощью браузера отследил полезную нагрузку, она имеет такую форму:
-----------------------------число из кука Content Type
Content-Disposition: form-data; name="file"; filename="имя файла"
Content-Type: text/xml
"содержимое текстового файла"
-----------------------------число из кука Content Type
Content-Disposition: form-data; name="submit"
send
-----------------------------число из кука Content Type--
Однако туториал по библиотеке request не внес ясности и следующий код возвращает статус 200, но на сайте не происходит изменений:
upload_file = directory + '/'+name_file
upload_url = 'адрес сайта'
post_data = {'filename': name_file}
upload_files = {'userfile': (name_file, open(upload_file, 'rb'))}
response = session.post(upload_url, files=upload_files, data=post_data)