Авторизация с использованием post запроса на сайте - Python

Узнай цену своей работы

Формулировка задачи:

Моя первая попытка авторизации на сайте.
Листинг программы
  1. import requests
  2. def autoriz():
  3. session = requests.Session()
  4. url= 'https://zcoin.miningpoolhub.com/index.php?page=login'
  5. data= {'username':'removed@mail.ru','password':'Overlord'}
  6. print(requests.get(url).text)
  7. print("-------------------------------------------")
  8. print(requests.post(url,data=data).text)
  9. def main():
  10. autoriz()
  11. if __name__ == '__main__':
  12. main()
Для проверки, я ожидал что в ответе с get запроса я найду "username",а с post запроса какой нибудь текст с сайта, но в место этого пришло что-то непонятно.
Листинг программы
  1. <!DOCTYPE HTML>
  2. <html lang="en-US">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  6. <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
  7. <meta name="robots" content="noindex, nofollow" />
  8. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  9. <title>Just a moment...</title>
  10. <style type="text/css">
  11. html, body {width: 100%; height: 100%; margin: 0; padding: 0;}
  12. body {background-color: #ffffff; font-family: Helvetica, Arial, sans-serif; font-size: 100%;}
  13. h1 {font-size: 1.5em; color: #404040; text-align: center;}
  14. p {font-size: 1em; color: #404040; text-align: center; margin: 10px 0 0 0;}
  15. #spinner {margin: 0 auto 30px auto; display: block;}
  16. .attribution {margin-top: 20px;}
  17. @-webkit-keyframes bubbles { 33%: { -webkit-transform: translateY(10px); transform: translateY(10px); } 66% { -webkit-transform: translateY(-10px); transform: translateY(-10px); } 100% { -webkit-transform: translateY(0); transform: translateY(0); } }
  18. @keyframes bubbles { 33%: { -webkit-transform: translateY(10px); transform: translateY(10px); } 66% { -webkit-transform: translateY(-10px); transform: translateY(-10px); } 100% { -webkit-transform: translateY(0); transform: translateY(0); } }
  19. .bubbles { background-color: #404040; width:15px; height: 15px; margin:2px; border-radius:100%; -webkit-animation:bubbles 0.6s 0.07s infinite ease-in-out; animation:bubbles 0.6s 0.07s infinite ease-in-out; -webkit-animation-fill-mode:both; animation-fill-mode:both; display:inline-block; }
  20. </style>
  21. <script type="text/javascript">
  22. //<![CDATA[
  23. (function(){
  24. var a = function() {try{return !!window.addEventListener} catch(e) {return !1} },
  25. b = function(b, c) {a() ? document.addEventListener("DOMContentLoaded", b, c) : document.attachEvent("onreadystatechange", b)};
  26. b(function(){
  27. var a = document.getElementById('cf-content');a.style.display = 'block';
  28. setTimeout(function(){
  29. var s,t,o,p,b,r,e,a,k,i,n,g,f, tsBuCVO={"auQlMgNig":!+[]+!![]};
  30. t = document.createElement('div');
  31. t.innerHTML="<a href='/'>x</a>";
  32. t = t.firstChild.href;r = t.match(/https?:\/\//)[0];
  33. t = t.substr(r.length); t = t.substr(0,t.length-1);
  34. a = document.getElementById('jschl-answer');
  35. f = document.getElementById('challenge-form');
  36. ;tsBuCVO.auQlMgNig*=!+[]+!![];tsBuCVO.auQlMgNig-=+((!+[]+!![]+!![]+[])+(+!![]));tsBuCVO.auQlMgNig-=+((+!![]+[])+(!+[]+!![]+!![]+!![]+!![]+!![]+!![]+!![]));a.value = parseInt(tsBuCVO.auQlMgNig, 10) + t.length; '; 121'
  37. f.action += location.hash;
  38. f.submit();
  39. }, 4000);
  40. }, false);
  41. })();
  42. //]]>
  43. </script>
  44.  
  45. </head>
  46. <body>
  47. <table width="100%" height="100%" cellpadding="20">
  48. <tr>
  49. <td align="center" valign="middle">
  50. <div class="cf-browser-verification cf-im-under-attack">
  51. <noscript><h1 data-translate="turn_on_js" style="color:#bd2426;">Please turn JavaScript on and reload the page.</h1></noscript>
  52. <div id="cf-content" style="display:none">
  53. <div>
  54. <div class="bubbles"></div>
  55. <div class="bubbles"></div>
  56. <div class="bubbles"></div>
  57. </div>
  58. <h1><span data-translate="checking_browser">Checking your browser before accessing</span> miningpoolhub.com.</h1>
  59. <p data-translate="process_is_automatic">This process is automatic. Your browser will redirect to your requested content shortly.</p>
  60. <p data-translate="allow_5_secs">Please allow up to 5 seconds&hellip;</p>
  61. </div>
  62. <form id="challenge-form" action="/cdn-cgi/l/chk_jschl" method="get">
  63. <input type="hidden" name="jschl_vc" value="23d57e1ef240a54d975a0d46b650077e"/>
  64. <input type="hidden" name="pass" value="1522076628.61-kSxsCArg94"/>
  65. <input type="hidden" id="jschl-answer" name="jschl_answer"/>
  66. </form>
  67. </div>
  68.  
  69. <div class="attribution">
  70. <a href="https://www.cloudflare.com/5xx-error-landing?utm_source=iuam" target="_blank" style="font-size: 12px;">DDoS protection by Cloudflare</a>
  71. <br>
  72. Ray ID: 401a8177c9422579
  73. </div>
  74. </td>
  75. </tr>
  76. </table>
  77. </body>
  78. </html>
  79. -------------------------------------------
  80. <!DOCTYPE HTML>
  81. <html lang="en-US">
  82. <head>
  83. <meta charset="UTF-8" />
  84. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  85. <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
  86. <meta name="robots" content="noindex, nofollow" />
  87. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  88. <title>Just a moment...</title>
  89. <style type="text/css">
  90. html, body {width: 100%; height: 100%; margin: 0; padding: 0;}
  91. body {background-color: #ffffff; font-family: Helvetica, Arial, sans-serif; font-size: 100%;}
  92. h1 {font-size: 1.5em; color: #404040; text-align: center;}
  93. p {font-size: 1em; color: #404040; text-align: center; margin: 10px 0 0 0;}
  94. #spinner {margin: 0 auto 30px auto; display: block;}
  95. .attribution {margin-top: 20px;}
  96. @-webkit-keyframes bubbles { 33%: { -webkit-transform: translateY(10px); transform: translateY(10px); } 66% { -webkit-transform: translateY(-10px); transform: translateY(-10px); } 100% { -webkit-transform: translateY(0); transform: translateY(0); } }
  97. @keyframes bubbles { 33%: { -webkit-transform: translateY(10px); transform: translateY(10px); } 66% { -webkit-transform: translateY(-10px); transform: translateY(-10px); } 100% { -webkit-transform: translateY(0); transform: translateY(0); } }
  98. .bubbles { background-color: #404040; width:15px; height: 15px; margin:2px; border-radius:100%; -webkit-animation:bubbles 0.6s 0.07s infinite ease-in-out; animation:bubbles 0.6s 0.07s infinite ease-in-out; -webkit-animation-fill-mode:both; animation-fill-mode:both; display:inline-block; }
  99. </style>
  100. <script type="text/javascript">
  101. //<![CDATA[
  102. (function(){
  103. var a = function() {try{return !!window.addEventListener} catch(e) {return !1} },
  104. b = function(b, c) {a() ? document.addEventListener("DOMContentLoaded", b, c) : document.attachEvent("onreadystatechange", b)};
  105. b(function(){
  106. var a = document.getElementById('cf-content');a.style.display = 'block';
  107. setTimeout(function(){
  108. var s,t,o,p,b,r,e,a,k,i,n,g,f, aaMRcfi={"XX":+((!+[]+!![]+[])+(!+[]+!![]+!![]+!![]+!![]+!![]+!![]))};
  109. t = document.createElement('div');
  110. t.innerHTML="<a href='/'>x</a>";
  111. t = t.firstChild.href;r = t.match(/https?:\/\//)[0];
  112. t = t.substr(r.length); t = t.substr(0,t.length-1);
  113. a = document.getElementById('jschl-answer');
  114. f = document.getElementById('challenge-form');
  115. ;aaMRcfi.XX*=+((!+[]+!![]+!![]+!![]+[])+(!+[]+!![]+!![]+!![]+!![]));aaMRcfi.XX+=+((!+[]+!![]+!![]+[])+(!+[]+!![]+!![]));a.value = parseInt(aaMRcfi.XX, 10) + t.length; '; 121'
  116. f.action += location.hash;
  117. f.submit();
  118. }, 4000);
  119. }, false);
  120. })();
  121. //]]>
  122. </script>
  123.  
  124. </head>
  125. <body>
  126. <table width="100%" height="100%" cellpadding="20">
  127. <tr>
  128. <td align="center" valign="middle">
  129. <div class="cf-browser-verification cf-im-under-attack">
  130. <noscript><h1 data-translate="turn_on_js" style="color:#bd2426;">Please turn JavaScript on and reload the page.</h1></noscript>
  131. <div id="cf-content" style="display:none">
  132. <div>
  133. <div class="bubbles"></div>
  134. <div class="bubbles"></div>
  135. <div class="bubbles"></div>
  136. </div>
  137. <h1><span data-translate="checking_browser">Checking your browser before accessing</span> miningpoolhub.com.</h1>
  138. <p data-translate="process_is_automatic">This process is automatic. Your browser will redirect to your requested content shortly.</p>
  139. <p data-translate="allow_5_secs">Please allow up to 5 seconds&hellip;</p>
  140. </div>
  141. <form id="challenge-form" action="/cdn-cgi/l/chk_jschl" method="get">
  142. <input type="hidden" name="jschl_vc" value="bd40a88586ca70ed99e08b989a59bd84"/>
  143. <input type="hidden" name="pass" value="1522076628.724-bJx7JZVuiU"/>
  144. <input type="hidden" id="jschl-answer" name="jschl_answer"/>
  145. </form>
  146. </div>
  147.  
  148. <div class="attribution">
  149. <a href="https://www.cloudflare.com/5xx-error-landing?utm_source=iuam" target="_blank" style="font-size: 12px;">DDoS protection by Cloudflare</a>
  150. <br>
  151. Ray ID: 401a81788af22513
  152. </div>
  153. </td>
  154. </tr>
  155. </table>
  156. </body>
  157. </html>
Как правильно авторизироваться?

Решение задачи: «Авторизация с использованием post запроса на сайте»

textual
Листинг программы
  1. gVfRDuZ.nQasjZJwiE*=+((!+[]+!![]+!![]+[])+(!+[]+!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![]));gVfRDuZ.nQasjZJwiE*=+((!+[]+!![]+[])+(!+[]+!![]+!![]));gVfRDuZ.nQasjZJwiE+=+((!+[]+!![]+!![]+[])+(!+[]+!![]+!![]+!![]+!![]+!![]+!![]));a.value = parseInt(gVfRDuZ.nQasjZJwiE, 10) + t.length; '; 121'

ИИ поможет Вам:


  • решить любую задачу по программированию
  • объяснить код
  • расставить комментарии в коде
  • и т.д
Попробуйте бесплатно

Оцени полезность:

12   голосов , оценка 3.917 из 5

Нужна аналогичная работа?

Оформи быстрый заказ и узнай стоимость

Бесплатно
Оформите заказ и авторы начнут откликаться уже через 10 минут