首页 > 解决方案 > 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?

标签: pythonhttppost

解决方案


如果您查看该页面,您可以看到这是表单中隐藏的预填充字段:

<div class="hide">
    <input type="hidden"
    id="pesel"
    name="pesel"
    value="038a858a4***d782b3f"/>
</div>

我不确定它是用来做什么的。跟踪、限速、CSRF,谁知道呢。

在任何情况下,您的代码都应该首先GET生成表单,以便在执行POST. 请注意,可能存在旨在限制您访问此页面的速率的服务条款或技术措施,但如果您“定期”执行此操作,那么这可能不是问题。


推荐阅读