对于存在的网页,但对于没有足够权限的用户(他们未登录或不属于正确的用户组),要提供的正确HTTP响应是什么?401?403?别的什么?到目前为止,我对每个人的看法都不太清楚.哪些用例适合每个响应?
http-status-codes http-response-codes http-headers http-status-code-403 http-status-code-401
class A:
def __init__(self):
print("world")
class B(A):
def __init__(self):
print("hello")
B() # output: hello
Run Code Online (Sandbox Code Playgroud)
在我使用超级构造函数的所有其他语言中隐式调用.如何在Python中调用它?我希望,super(self)但这不起作用.
我在生产中使用 Django。
我看到如果未经身份验证的用户访问公开的 API - 服务器将返回 HTTP 401 Unauthorized。
如果用户将访问不存在的API(有或没有身份验证) - 服务器将返回 404 Not found。
在我看来,这像是一种糟糕的安全做法,并允许攻击者找到服务器公开的 API。
有没有办法改变它,这样两者都会返回完全相同的结果(我认为 401 是最佳实践,不是吗?)
class ×1
constructor ×1
django ×1
http-headers ×1
inheritance ×1
python ×1
security ×1
superclass ×1