def is_cross_origin_accessible(path, origin='http://example.org'):
"""
Returns True if the path is accessible at the given origin
(default: example.org).
Raises AssertionError otherwise.
"""
response = requests.options(path, headers={'Origin': origin})
assert response.status_code == 200
assert is_allowed_origin(origin, response)
return True
评论列表
文章目录