我已经用python创建了一个脚本,使用requests模块分别使用名称和密码SIMMTH.iqbal_123
和SShift_123
登录到这个site。我现在想做的是在填写相应的表格后保存一份申请表。但是,登录后,当您浏览此link时,您将看到表单。这就是form的样子(我手动填写并保存的字段)
到目前为止,我已经尝试过:
import requests
from bs4 import BeautifulSoup
link = 'https://jobs.allianz.com/sap/bc/bsp/sap/zhcmx_erc_ui_ex/desktop.html#/APPLICATION/57259884'
post_url = 'https://jobs.allianz.com/sap/opu/odata/hcmx/erc_ui_auth_srv/ProfileSet?sap-client=100&sap-language=en'
payload = {"ProfileID":1,"Firstname":"taher","Lastname":"iqbal","Address1":"","Address2":"","City":"","PostalCode":"","Email":"mthupwork@gmail.com","Phone1":"","Phone2":"01790127774","HasAcceptedPrivStmt":True,"IsLocked":True,"ThumbnailUrl":"","PhotoUrl":"","Phone3":"","PrefDescription":"","PrefWillingessRelocate":None,"PrefWillingnessTravel":None,"PrefIndustrySet":[],"PrefLocationSet":[],"PrefHierarchyLevelSet":[],"PrefFunctionalAreaSet":[],"Salutation":2,"Country":{"CountryID":"BD"}}
with requests.Session() as s:
s.headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36'
s.auth = ("SIMMTH.iqbal_123", "SShift_123")
s.get("https://jobs.allianz.com/sap/hcmx/validate_ea?sap-client=100&sap-language={2}")
s.get("https://jobs.allianz.com/sap/opu/odata/hcmx/erc_ui_auth_srv/UserSet('me')?sap-client=100&sap-language=en")
res = s.post(post_url,json=payload,headers={
'Content-Type': 'application/json;odata=verbose',
'Referer': 'https://jobs.allianz.com/sap/bc/bsp/sap/zhcmx_erc_ui_ex/desktop.html'
})
print(res.status_code)
我对上面的payload
的值进行了一些更改,以便检查脚本是否能够修改表单。但是,当我执行脚本时,它会给我403
状态代码
How can I save the fields of the form in that webpage using requests?
顺便说一句,this是我以前的帖子
输出:
相关问题 更多 >
编程相关推荐