python - How to find out what's the hash added to POST method
问题描述
I'm writing a python script to periodically check my driving licence status with DVLA. I used the chrome console to find out what form data is being posted and this is how it looks like:
url: https://www.viewdrivingrecord.service.gov.uk/driving-record/licence-number
applicantPassportNumber:
pesel: 6464a709f574de3e7*****ab7e6790aef
dln: *driving licence number here
nino: *national Insurance here
postcode: *postcode here
dwpPermission: 1
I have a problem with the "pesel" field. It changes with each request, however, old ones work when used with python requests POST method. The old ones even work with different licence holder details so it's not generated from form data. I don't want to hardcode it but can't figure out where it's coming from or how it's generated. I'm fairly new and still learning so may be missing something obvious but is there a way to find out what it is?
解决方案
如果您查看该页面,您可以看到这是表单中隐藏的预填充字段:
<div class="hide">
<input type="hidden"
id="pesel"
name="pesel"
value="038a858a4***d782b3f"/>
</div>
我不确定它是用来做什么的。跟踪、限速、CSRF,谁知道呢。
在任何情况下,您的代码都应该首先GET
生成表单,以便在执行POST
. 请注意,可能存在旨在限制您访问此页面的速率的服务条款或技术措施,但如果您“定期”执行此操作,那么这可能不是问题。
推荐阅读
- reactjs - 是否可以在 GoodDataUI 可视化中将数据限制为一个数字并将剩余数据组合为 **Others**?
- r - 根据 Shiny 中的选定行更改数据值
- json - 我们可以在 Visual Studio Code 中为 markdown 语言编写代码片段吗?
- java - 是否可以将 MailDev 与 Java 一起使用?
- python - 使用 pywinauto 获取图像按钮
- java - 无法在 Eclipse 中导入 Maven 依赖项?尝试了一切
- python - 与模式部分匹配
- nginx - Nginx:在上游离线时捕获发布请求
- excel - 将 PDF 拆分为每页的新文件 - Excel VBA
- javascript - vscode 无法启动,无法连接 WSL