任何人都可以告诉我request
和热门requests
模块之间的区别在于Python吗?
答案 0 :(得分:2)
来自PYPI - > https://pypi.org/project/request/
来自Github - > https://github.com/looking-for-a-job/request.py
这似乎是一个未完成的模块。只需将其卸载,
即可 ## This is just to confirm the expected hostname for this code sample
if ((& hostname) -ne 'EC2AMAZ-P9HUK50') {
throw "Unexpected hostname!"
}
$password = 'FOOBARNON'
$passwordSS = ConvertTo-SecureString -String $password -AsPlainText -Force
## The only way to force a null username
$passCred = New-Object PSCredential([pscustomobject]@{
UserName = $null
## Not really sure why we need to index this, but it's necessary,
## anybody have any thoughts???
Password = $passwordSS[0]
})
Add-Computer -DomainName "sub.example.local" -Options UnsecuredJoin,PasswordPass -Credential $passCred
然后使用pip uninstall request
安装请求模块。
答案 1 :(得分:0)
request 是 http 请求,当您编写代码并且想要访问命中您的函数的 HTTP 请求数据时使用它,例如 request.method 或 request .user
def GetUser(request):
return request.user
请求是您需要安装它的库,肝脏使您的代码能够像浏览器一样运行,您的代码可以在其中访问网站并从中获取数据
pip install requests
response = requests.get('https://api.github.com')
response.status_code
这将打印出 200 OK