表达式 "fetching URLs" 的实际含义是什么?
what does the expression "fetching URLs" actually mean?
我正在学习使用 urllib
Python 模块。
当我们使用它时,有时我们会这样编码:
req = urllib.request.Request(URL)
urlopen(req)
或者从一开始就直接使用 urlopen,例如:
urllib.request.urlopen
但是当我试图理解如何编码的逻辑流程时,
我对这个术语本身感到困惑:为什么术语 fetching URL 被命名来描述这种行为?
在我的初级理解中,fetch URL 意味着检索 "URLs" 但是当我们使用像 urlopen()
这样的函数时,它是 fetch URLs ,我们是给函数 URLs 的人,函数不获取 URLs 但给我们响应对象,是否也正确?
或者它仅表示“获取(给定的数据)URLs?
"to request"是不是还有别的意思?
我的解释中缺少什么逻辑要素?
我怀疑它与目的有某种关系,fetching
来自 url 的东西,例如javascript 中 API fetch 的用法示例。
The Fetch API provides an interface for fetching resources (including
across the network). It will seem familiar to anyone who has used
XMLHttpRequest, but the new API provides a more powerful and flexible
feature set.
The fetch() method takes one mandatory argument, the path to the
resource you want to fetch. It returns a Promise that resolves to the
Response to that request, whether it is successful or not. You can
also optionally pass in an init options object as the second argument
(see Request).
这是因为你正在从 url 中取东西。
您大多已经用
回答了自己
Or it only means "fetching (data with the given) URLs?
如 documentation 所述:
HTTP is based on requests and responses - the client makes requests and servers send responses. urllib.request mirrors this with a Request object which represents the HTTP request you are making. In its simplest form you create a Request object that specifies the URL you want to fetch. Calling urlopen with this Request object returns a response object for the URL requested. This response is a file-like object, which means you can for example call .read() on the response […]
此外,方法 urlopen
接受字符串或 Request
对象(参见 documentation):
The urllib.request module defines the following functions:
urllib.request.urlopen
(url, data=None, [timeout, ]*, cafile=None,
capath=None, cadefault=False, context=None)
Open the URL url, which can be either a string or a Request object.
我正在学习使用 urllib
Python 模块。
当我们使用它时,有时我们会这样编码:
req = urllib.request.Request(URL)
urlopen(req)
或者从一开始就直接使用 urlopen,例如:
urllib.request.urlopen
但是当我试图理解如何编码的逻辑流程时, 我对这个术语本身感到困惑:为什么术语 fetching URL 被命名来描述这种行为?
在我的初级理解中,fetch URL 意味着检索 "URLs" 但是当我们使用像 urlopen()
这样的函数时,它是 fetch URLs ,我们是给函数 URLs 的人,函数不获取 URLs 但给我们响应对象,是否也正确?
或者它仅表示“获取(给定的数据)URLs?
"to request"是不是还有别的意思?
我的解释中缺少什么逻辑要素?
我怀疑它与目的有某种关系,fetching
来自 url 的东西,例如javascript 中 API fetch 的用法示例。
The Fetch API provides an interface for fetching resources (including across the network). It will seem familiar to anyone who has used XMLHttpRequest, but the new API provides a more powerful and flexible feature set.
The fetch() method takes one mandatory argument, the path to the resource you want to fetch. It returns a Promise that resolves to the Response to that request, whether it is successful or not. You can also optionally pass in an init options object as the second argument (see Request).
这是因为你正在从 url 中取东西。
您大多已经用
回答了自己Or it only means "fetching (data with the given) URLs?
如 documentation 所述:
HTTP is based on requests and responses - the client makes requests and servers send responses. urllib.request mirrors this with a Request object which represents the HTTP request you are making. In its simplest form you create a Request object that specifies the URL you want to fetch. Calling urlopen with this Request object returns a response object for the URL requested. This response is a file-like object, which means you can for example call .read() on the response […]
此外,方法 urlopen
接受字符串或 Request
对象(参见 documentation):
The urllib.request module defines the following functions:
urllib.request.urlopen
(url, data=None, [timeout, ]*, cafile=None, capath=None, cadefault=False, context=None)Open the URL url, which can be either a string or a Request object.