python - 无法在与任何随机城市相关的有效负载中使用 lat,long 的值?
问题描述
我编写了一个脚本来从网页中获取不同属性的链接。当我使用此关键字执行搜索时,该站点中的属性会显示,toronto
正如您在此图像中看到的那样。
下面的脚本可以解析不同属性的链接。但是,我不明白的是,除了从开发工具复制之外,我如何使用 lat 的值,long 。此外,我toronto
在搜索框中使用过,但以下有效负载没有。我认为有效载荷内的经纬度代表城市。
import requests
link = "https://api2.realtor.ca/Listing.svc/PropertySearch_Post"
payload = {
'ZoomLevel': '10',
'LatitudeMax': '43.92411',
'LongitudeMax': '-78.73025',
'LatitudeMin': '43.49129',
'LongitudeMin': '-80.02252',
'Sort': '1-A',
'PropertyTypeGroupID': '1',
'PropertySearchTypeId': '1',
'TransactionTypeId': '2',
'Currency': 'CAD',
'RecordsPerPage': '12',
'ApplicationId': '1',
'CultureId': '1',
'Version': '7.0',
'CurrentPage': '1'
}
with requests.Session() as s:
s.headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 6.1; ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36'
r = s.post(link,data=payload)
for item in r.json()['Results']:
print(item['RelativeDetailsURL'])
如何在与任何自定义城市相关的有效载荷中使用 lat、long?
解决方案
纬度和经度确实代表城市。
'LatitudeMax': '46.88411',
'LongitudeMax': '-72.06525',
'LatitudeMin': '46.14629',
'LongitudeMin': '-70.57902',
在感兴趣的区域上形成一个正方形。因此,使用上述值,您将获得魁北克地区作为示例。
推荐阅读
- c++ - c++初始化二叉树节点
- twitter - 从 process_data 中的 tweet raw_data 打印 tweet full_text
- go - 为什么 runtime.Caller(0) 返回构建二进制文件的路径?
- ruby-on-rails - 如何将多个表与多个位置连接起来
- ios - ViewController 关闭后的辅助功能焦点顺序无意中转到第一个元素
- python - 在 Python 中读取 PostgreSQL 数组数据
- java - 过滤嵌套实体弹簧靴中的响应
- node.js - 我对 Firebase 托管和 AWS 有疑问
- git - 努力休息后无法推动 - 一切都是最新的
- datatable - 如何发送jquery数据表导出文件的电子邮件