Всем привет!
Стоит задача спарсить данные с сайта, исользую requests.Session().
Вначале логинюсь на сайте - проблем нет, но при get запросе начинается веселье: в браузере в ответ я получаю:
<!-- Begin: repeated data rows -->
<TR name="DataContainer" class='TCP_RowOdd'>
<TD name="ColumnData" valign="top" style="text-align:left;" nowrap="" width="10px" align="Center"><SPAN name='column1_1_wrapper' _name_="column1" onclick="column1Select(this);"><INPUT type="hidden" value='false' name='column1_1'><SPAN>
<INPUT type="checkbox" name="cb_column1_1" id="checkBox_0Usage_00215portlet_00215UsageCustomerMetersPortlet_00515ThrdPartyUser_00515Default_00515Default_00515Default_00515agreement_0051515ab8f32727_0051518260_1" onclick="var _el = this.form.elements['column1_1']; if (this.checked) _el.value='true';else _el.value='false'; if (_el.onchange) _el.onchange()" /> <label for="checkBox_0Usage_00215portlet_00215UsageCustomerMetersPortlet_00515ThrdPartyUser_00515Default_00515Default_00515Default_00515agreement_0051515ab8f32727_0051518260_1"> </label></SPAN></SPAN></TD>
<TD name="ColumnData" valign="top" style="text-align:left;" nowrap=""><SPAN name="column2">11507</SPAN></TD>
<TD name="ColumnData" valign="top" style="text-align:left;" nowrap=""><SPAN name="column3">1008901017189209322100</SPAN></TD>
<TD name="ColumnData" valign="top" style="text-align:left;" nowrap=""><SPAN name="column4">Nasizadeh</SPAN></TD>
<TD name="ColumnData" valign="top" style="text-align:left;" nowrap=""><SPAN name="column5">N/A</SPAN></TD>
<TD name="ColumnData" valign="top" style="text-align:left;" nowrap=""><SPAN name="column6"></SPAN></TD>
</TR>
<TR name="DataContainer" class='TCP_RowEven'>
<TD name="ColumnData" valign="top" style="text-align:left;" nowrap="" width="10px" align="Center"><SPAN name='column1_2_wrapper' _name_="column1" onclick="column1Select(this);"><INPUT type="hidden" value='false' name='column1_2'><SPAN>
<INPUT type="checkbox" name="cb_column1_2" id="checkBox_0Usage_00215portlet_00215UsageCustomerMetersPortlet_00515ThrdPartyUser_00515Default_00515Default_00515Default_00515agreement_0051515ab8f32727_0051518260_2" onclick="var _el = this.form.elements['column1_2']; if (this.checked) _el.value='true';else _el.value='false'; if (_el.onchange) _el.onchange()" /> <label for="checkBox_0Usage_00215portlet_00215UsageCustomerMetersPortlet_00515ThrdPartyUser_00515Default_00515Default_00515Default_00515agreement_0051515ab8f32727_0051518260_2"> </label></SPAN></SPAN></TD>
<TD name="ColumnData" valign="top" style="text-align:left;" nowrap=""><SPAN name="column2">9151</SPAN></TD>
<TD name="ColumnData" valign="top" style="text-align:left;" nowrap=""><SPAN name="column3">1008901023817840720106</SPAN></TD>
<TD name="ColumnData" valign="top" style="text-align:left;" nowrap=""><SPAN name="column4">Nasizadeh</SPAN></TD>
<TD name="ColumnData" valign="top" style="text-align:left;" nowrap=""><SPAN name="column5">N/A</SPAN></TD>
<TD name="ColumnData" valign="top" style="text-align:left;" nowrap=""><SPAN name="column6"></SPAN></TD>
</TR>
<input name="Row_MaxOrdinal" type="hidden" value='2'><input name="Row_MinOrdinal" type="hidden" value='1'><!-- End: repeated data rows -->
<TR>
<TD colspan="100" align="left">
<TABLE cellpadding="0" cellspacing="0" width="100%" name="TableEmptyData"><TR class="EmptyDataMessageRow"><TD align="left" class="EmptyDataMessageCell">
</TD></TR></TABLE>
</TD>
</TR>
<TR><TD colspan="100"><SPAN name="tag_pagesShown">Showing 1 - 2 of 2</SPAN> </TD></TR>
</TABLE>
А если делаю такой же запрос скриптом (все headers и cookies прописаны), то вижу:
<!-- Begin: repeated data rows -->
<input name="Row_MaxOrdinal" type="hidden" value='0'><input name="Row_MinOrdinal" type="hidden" value='1'><!-- End: repeated data rows -->
<TR>
<TD colspan="100" align="left">
<TABLE cellpadding="0" cellspacing="0" width="100%" name="TableEmptyData"><TR class="EmptyDataMessageRow"><TD align="left" class="EmptyDataMessageCell">
<SPAN name="EmptyDataMessage" class="emptyDataMessage">No results found.</SPAN>
В чем может быть такая проблема?