You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bazarr/custom_libs/subzero/lib/httpfake.py

47 lines
1009 B

5 years ago
import six
6 years ago
# coding=utf-8
class PlexPyNativeResponseProxy(object):
"""
The equally stupid counterpart to Sub-Zero.support.lib.PlexPyNativeRequestProxy.
Incompletely mimics a requests response object for the plex.py library to use.
"""
data = None
headers = None
response_code = None
request = None
def __init__(self, response, status_code, request):
if response:
self.data = response.content
self.headers = response.headers
self.response_code = status_code
self.request = request
def content(self):
return self.data
content = property(content)
def status_code(self):
return self.response_code
status_code = property(status_code)
def url(self):
return self.request.url
url = property(url)
def __str__(self):
return str(self.data)
def __unicode__(self):
5 years ago
return six.text_type(self.data)
6 years ago
def __repr__(self):
return repr(self.data)