cari

Rumah  >  Soal Jawab  >  teks badan

c# - 用python requests POST提交数据,但是无法模拟成功?

1,我想通过python Requests获取和上传到公司的sharepoint网站数据,目前已经通过python模拟Windows验证成功并GET所需数据,但是在POST的时候,无法成功。
例如我想添加一个名为AP1test的用户到权限组中(后面有图)。
2,我在POST的时候,尝试过伪装Header,包括伪装cookie,结果都是无法POST成功。
3,表单截图和我在chrome中抓到POST的完整包如下,请求各位大师帮忙解答一下如何才能成功提交数据。
4,简单点问的话,就是,模拟下面这个POST的过程,我需要上传什么格式的数据,这个'?'要怎么构造~
wbdata=requests.post(url,data=?)

Remote Address:xxx.xx.xxx.xxx:80
Request URL:http://xxx.xx.xxx.xxx/DocLibs...

**Request Method:POST
Status Code:200 OK**

Response Headers
view source
Cache-Control:private
Content-Encoding:gzip
Content-Type:text/html; charset=utf-8
Date:Thu, 17 Nov 2016 02:58:41 GMT
MicrosoftSharePointTeamServices:14.0.0.6117
Server:Microsoft-IIS/7.5
Set-Cookie:WSS_KeepSessionAuthenticated={1d44c43a-635d-42c2-b3a4-3b5818701b3c}; path=/
Set-Cookie:WSS_KeepSessionAuthenticated={1d44c43a-635d-42c2-b3a4-3b5818701b3c}; path=/
SPRequestGuid:ecc06d99-c940-4881-bd79-c128fe335437
Transfer-Encoding:chunked
Vary:Accept-Encoding
X-AspNet-Version:2.0.50727
X-MS-InvokeApp:1; RequireReadOnly
X-Powered-By:ASP.NET
X-SharePointHealthScore:0
Cache-Control:private
Content-Encoding:gzip
Content-Type:text/html; charset=utf-8
Date:Thu, 17 Nov 2016 02:58:41 GMT
MicrosoftSharePointTeamServices:14.0.0.6117
Server:Microsoft-IIS/7.5
Set-Cookie:WSS_KeepSessionAuthenticated={1d44c43a-635d-42c2-b3a4-3b5818701b3c}; path=/
Set-Cookie:WSS_KeepSessionAuthenticated={1d44c43a-635d-42c2-b3a4-3b5818701b3c}; path=/
SPRequestGuid:ecc06d99-c940-4881-bd79-c128fe335437
Transfer-Encoding:chunked
Vary:Accept-Encoding
X-AspNet-Version:2.0.50727
X-MS-InvokeApp:1; RequireReadOnly
X-Powered-By:ASP.NET
X-SharePointHealthScore:0

Request Headers
view source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
Accept-Encoding:gzip, deflate
Accept-Language:zh-CN,zh;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:45252
Content-Type:application/x-www-form-urlencoded
Cookie:WSS_KeepSessionAuthenticated={1d44c43a-635d-42c2-b3a4-3b5818701b3c}
Host:xxx.xx.xxx.xxx
Origin:http://xxx.xx.xxx.xxx
Referer:http://xxx.xx.xxx.xxx/DocLibs...
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36
Query String Parameters
view source
view URL encoded
GroupId:8665
IsDlg:1

Form Data
view source
view URL encoded
MSOWebPartPage_PostbackSource:
MSOTlPn_SelectedWpId:
MSOTlPn_View:0
MSOTlPn_ShowSettings:False
MSOGallery_SelectedLibrary:
MSOGallery_FilterString:
MSOTlPn_Button:none
MSOSPWebPartManager_DisplayModeName:Browse
MSOSPWebPartManager_ExitingDesignMode:false
__EVENTTARGET:ctl00$PlaceHolderMain$ctl01$RptControls$btnOK
__EVENTARGUMENT:
MSOWebPartPage_Shared:
MSOLayout_LayoutChanges:
MSOLayout_InDesignMode:
MSOSPWebPartManager_OldDisplayModeName:Browse
MSOSPWebPartManager_StartWebPartEditingName:false
MSOSPWebPartManager_EndWebPartEditing:false
_maintainWorkspaceScrollPosition:0
__spPickerHasReturnValue:
__spPickerReturnValueHolder:
__REQUESTDIGEST:0xE3EB894AE6EAC2CA3D10CCF35F68CED435C09263CDA2FD36CB354531011D265E95A7882F340DCEEBEF07F3B716E793CCCCFBF2D13E03AF742511B8F08F4A40EC,17 Nov 2016 02:58:17 -0000
__VIEWSTATE:/wEPDwUKLTg0NzQwNzQ4MA9kFgJmD2QWAgIBDxYCHgVjbGFzcwUWbXMtZGlhbG9nIG1zLWRpYWxvZy1uchYCAgMPZBYKAhEPZBYEZg9kFgQCAQ9kFgJmD2QWBAICD2QWCgIBDxYCHgBQlJQlPigJNCU0Nkdinr4g9g1OaX4Gje2CQWCzZsMQg=
__VIEWSTATEGENERATOR:58E4804D
__EVENTVALIDATION:/wEWCwLn/sesAwK1s5fnCALty/+8DgLZu6yaDQL5pZOpCwLW6vL1CwKTv/WqAgLLtd3hBgLd0oKSCwLV3d/oDwKmp+GoBg5gA57lCqNaIc7OfJxZw78M2u51
ctl00$PlaceHolderMain$ctl00$ctl01$userPicker$hiddenSpanData: <span id="spanAP1test" iscontenttype="true" tabindex="-1" class="ms-entity-resolved" contenteditable="false" title="AP1test"><p style="display:none;" id="pEntityData" key="AP1test" displaytext="Wang, test" isresolved="True" description="AP1test"><p data="<ArrayOfDictionaryEntry xmlns:xsi=&quot;http://www.w3.org/2001/XMLSch... xmlns:xsd=&quot;http://www.w3.org/2001/XMLSch... xsi:type=&quot;xsd:string&quot;>SPUserID</Key><Value xsi:type=&quot;xsd:string&quot;>3967</Value></DictionaryEntry><DictionaryEntry><Key xsi:type=&quot;xsd:string&quot;>AccountName</Key><Value xsi:type=&quot;xsd:string&quot;>AP1test</Value></DictionaryEntry><DictionaryEntry><Key xsi:type=&quot;xsd:string&quot;>Email</Key><Value xsi:type=&quot;xsd:string&quot;>test.Wang@cn .ab-inbev.com</Value></DictionaryEntry><DictionaryEntry><Key xsi:type=&quot;xsd:string&quot;>Department</Key><Value xsi:type=&quot;xsd:string&quot;>Inforcell</Value></DictionaryEntry><DictionaryEntry><Key xsi:type=&quot;xsd:string&quot;>PrincipalType</Key><Value xsi:type=&quot;xsd:string&quot;>User</Value></DictionaryEntry><DictionaryEntry><Key xsi:type=&quot;xsd:string&quot;>Title</Key><Value xsi:type=&quot;xsd:string&quot;>Reporting Specialist</Value></DictionaryEntry></ArrayOfDictionaryEntry>"></p></p><span id="content" tabindex="-1" contenteditable="false" onmousedown="onMouseDownRw(event);" oncontextmenu="onContextMenuSpnRw(event,ctx);">Wang, test</span></span>;
ctl00$PlaceHolderMain$ctl00$ctl01$userPicker$OriginalEntities:<Entities />
ctl00$PlaceHolderMain$ctl00$ctl01$userPicker$HiddenEntityKey:
ctl00$PlaceHolderMain$ctl00$ctl01$userPicker$HiddenEntityDisplayText:
ctl00$PlaceHolderMain$ctl00$ctl01$userPicker$downlevelTextBox: <span id='spanAP1test' isContentType='true' tabindex='-1' class='ms-entity-resolved' contentEditable='false' title='AP1test'><p style='display:none;' id='pEntityData' key='AP1test' displaytext='Wang, test' isresolved='True' description='AP1test'><p data='&lt;ArrayOfDictionaryEntry xmlns:xsi=&quot;http://www.w3.org/2001/XMLSch... xmlns:xsd=&quot;http://www.w3.org/2001/XMLSch... xsi:type=&quot;xsd:string&quot;&gt;SPUserID&lt;/Key&gt;&lt;Value xsi:type=&quot;xsd:string&quot;&gt;3967&lt;/Value&gt;&lt;/DictionaryEntry&gt;&lt;DictionaryEntry&gt;&lt;Key xsi:type=&quot;xsd:string&quot;&gt;AccountName&lt;/Key&gt;&lt;Value xsi:type=&quot;xsd:string&quot;&gt;AP1test&lt;/Value&gt;&lt;/DictionaryEntry&gt;&lt;DictionaryEntry&gt;&lt;Key xsi:type=&quot;xsd:string&quot;&gt;Email&lt;/Key&gt;&lt;Value xsi:type=&quot;xsd:string&quot;&gt;test.Wang@cn .ab-inbev.com&lt;/Value&gt;&lt;/DictionaryEntry&gt;&lt;DictionaryEntry&gt;&lt;Key xsi:type=&quot;xsd:string&quot;&gt;Department&lt;/Key&gt;&lt;Value xsi:type=&quot;xsd:string&quot;&gt;Inforcell&lt;/Value&gt;&lt;/DictionaryEntry&gt;&lt;DictionaryEntry&gt;&lt;Key xsi:type=&quot;xsd:string&quot;&gt;PrincipalType&lt;/Key&gt;&lt;Value xsi:type=&quot;xsd:string&quot;&gt;User&lt;/Value&gt;&lt;/DictionaryEntry&gt;&lt;DictionaryEntry&gt;&lt;Key xsi:type=&quot;xsd:string&quot;&gt;Title&lt;/Key&gt;&lt;Value xsi:type=&quot;xsd:string&quot;&gt;Reporting Specialist&lt;/Value&gt;&lt;/DictionaryEntry&gt;&lt;/ArrayOfDictionaryEntry&gt;'></p></p><span id='content' tabindex='-1' contenteditable='false' onmousedown='onMouseDownRw(event);' onContextMenu='onContextMenuSpnRw(event,ctx);' >Wang, test</span></span>;
__spText1:
__spText2:

大家讲道理大家讲道理2812 hari yang lalu962

membalas semua(0)saya akan balas

Tiada jawapan
  • Batalbalas