gpt4 book ai didi

python - python 如何知道需要通过 api.py 接口(interface) requests 模块?

转载 作者:行者123 更新时间:2023-12-01 05:40:07 25 4
gpt4 key购买 nike

在深入了解 Python 的过程中,我一直在研究名为 requests 或有时称为 python-requests 的 Python 模块的结构。

现在的问题是this ,它是 requests github 存储库中 api.py 文件的链接,您将看到它提供了模块的接口(interface),这是预期的。我的问题是 Python 如何知道所有接口(interface)都是在 api.py 中完成的,而在创建可重用模块时是否必须包含 api.py 文件?

如果有任何文档链接,我将不胜感激。

最佳答案

请参见此处: https://github.com/kennethreitz/requests/blob/master/requests/__init__.py

例如如果“requests”是一个目录,其中有 __init__.py ,Python每次看到from requests import ...时都会执行这个文件或import requests .

查看更多Modues .

关于python - python 如何知道需要通过 api.py 接口(interface) requests 模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17770412/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com