Py学习  »  Python

如何用Python从web API中收集所有结果?

Beautiful Mind • 7 年前 • 2177 次点击  

我正在使用python脚本从web api收集数据。Web API提供最多50个结果( "size":50 )但是,我需要收集所有的结果请告诉我怎么做我的初始代码如下。提前谢谢你。

def getData():
    headers = {
    'Content-type': 'application/json',
    }

    data = '{"size":50,"sites.recruitment_status":"ACTIVE", "sites.org_state_or_province":"VA"}'
    response = requests.post('https://clinicaltrialsapi.cancer.gov/v1/clinical-trials', headers=headers, data=data)

    print(response.json())
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/48462
文章 [ 2 ]  |  最新文章 7 年前