Python django.http.HttpResponse.__init__() Examples
The following are 6
code examples of django.http.HttpResponse.__init__().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
django.http.HttpResponse
, or try the search function
.
Example #1
Source File: user_auth.py From kobo-predict with BSD 2-Clause "Simplified" License | 5 votes |
def __init__(self): HttpResponse.__init__(self) self['WWW-Authenticate'] =\ 'Basic realm="%s"' % Site.objects.get_current().name
Example #2
Source File: views.py From anytask with MIT License | 5 votes |
def __init__(self, *args, **kwargs): HttpResponse.__init__(self, *args, **kwargs) self.status_code = 401 self["WWW-Authenticate"] = 'Basic realm="AnyTask SVN access"'
Example #3
Source File: response.py From zulip with Apache License 2.0 | 5 votes |
def __init__(self, realm: str, www_authenticate: Optional[str]=None) -> None: HttpResponse.__init__(self) if www_authenticate is None: self["WWW-Authenticate"] = f'Basic realm="{realm}"' elif www_authenticate == "session": self["WWW-Authenticate"] = f'Session realm="{realm}"' else: raise AssertionError("Invalid www_authenticate value!")
Example #4
Source File: general.py From daywatch with MIT License | 5 votes |
def __init__(self, obj): self.original_obj = obj HttpResponse.__init__(self, self.serialize()) self["Content-Type"] = "text/javascript"
Example #5
Source File: http.py From canvas with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, www_authenticate): HttpResponse.__init__(self) self['WWW-Authenticate'] = www_authenticate
Example #6
Source File: http.py From canvas with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, *args, **kwargs): self.response = HttpResponseUnauthorized(*args, **kwargs) super(HttpUnauthorizedException, self).__init__(unicode(self.response))