Python未解决的进口请求

发布于 2025-02-09 18:16:33 字数 637 浏览 0 评论 0原文

我有一个非常令人沮丧的问题。我想运行这个简单的脚本,但我不能,因为请求尚未安装,但它是。我正在使用Visual Studio 2019,我对Python一无所知。通常我正在使用C#编程。

from pprint import pprint
import requests

URL = 'https://discosweb.esoc.esa.int'
token = '<token>'

response = requests.get(
    f'{URL}/api/objects',
    headers={
        'Authorization': f'Bearer {token}',
        'DiscosWeb-Api-Version': '2',
    },
    params={
        'filter': "eq(objectClass,Payload)&gt(reentry.epoch,epoch:'2020-01-01')",
        'sort': '-reentry.epoch',
    },
)

doc = response.json()
if response.ok:
    pprint(doc['data'])
else:
    pprint(doc['errors']))

I have a very frustrating problem. I want to run this simple script but I can't because requests is not installed but it is. I am using Visual Studio 2019 and I have no clue about Python. Normally I am programming with C#.

from pprint import pprint
import requests

URL = 'https://discosweb.esoc.esa.int'
token = '<token>'

response = requests.get(
    f'{URL}/api/objects',
    headers={
        'Authorization': f'Bearer {token}',
        'DiscosWeb-Api-Version': '2',
    },
    params={
        'filter': "eq(objectClass,Payload)>(reentry.epoch,epoch:'2020-01-01')",
        'sort': '-reentry.epoch',
    },
)

doc = response.json()
if response.ok:
    pprint(doc['data'])
else:
    pprint(doc['errors']))

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

任谁 2025-02-16 18:16:33

正如错误消息所建议的那样,很自然地怀疑您没有 python package 请求 已安装。您可能想看一下此Visual Studio教程用于Python软件包安装:)

As suggested by the error message, it is natural to suspect that you don't have the Python package requests installed. You might want to take a look at this Visual Studio tutorial for Python package installation :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文