Python urllib2.HTTPHandler() Examples
The following are 30
code examples of urllib2.HTTPHandler().
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
urllib2
, or try the search function
.
Example #1
Source File: index.py From splunk-aws-project-trumpet with MIT License | 6 votes |
def sendResponse(event, context, responseStatus, responseData): responseBody = json.dumps({ "Status": responseStatus, "Reason": "See the details in CloudWatch Log Stream: " + context.log_stream_name, "PhysicalResourceId": context.log_stream_name, "StackId": event['StackId'], "RequestId": event['RequestId'], "LogicalResourceId": event['LogicalResourceId'], "Data": responseData }) logger.info('ResponseURL: {}'.format(event['ResponseURL'])) logger.info('ResponseBody: {}'.format(responseBody)) opener = build_opener(HTTPHandler) request = Request(event['ResponseURL'], data=responseBody) request.add_header('Content-Type', '') request.add_header('Content-Length', len(responseBody)) request.get_method = lambda: 'PUT' response = opener.open(request) print("Status code: {}".format(response.getcode())) print("Status message: {}".format(response.msg))
Example #2
Source File: keepalive.py From NoobSec-Toolkit with GNU General Public License v2.0 | 6 votes |
def comp(N, url): print ' making %i connections to:\n %s' % (N, url) sys.stdout.write(' first using the normal urllib handlers') # first use normal opener opener = urllib2.build_opener() urllib2.install_opener(opener) t1 = fetch(N, url) print ' TIME: %.3f s' % t1 sys.stdout.write(' now using the keepalive handler ') # now install the keepalive handler and try again opener = urllib2.build_opener(HTTPHandler()) urllib2.install_opener(opener) t2 = fetch(N, url) print ' TIME: %.3f s' % t2 print ' improvement factor: %.2f' % (t1/t2, )
Example #3
Source File: keepalive.py From NoobSec-Toolkit with GNU General Public License v2.0 | 6 votes |
def error_handler(url): global HANDLE_ERRORS orig = HANDLE_ERRORS keepalive_handler = HTTPHandler() opener = urllib2.build_opener(keepalive_handler) urllib2.install_opener(opener) pos = {0: 'off', 1: 'on'} for i in (0, 1): print " fancy error handling %s (HANDLE_ERRORS = %i)" % (pos[i], i) HANDLE_ERRORS = i try: fo = urllib2.urlopen(url) foo = fo.read() fo.close() try: status, reason = fo.status, fo.reason except AttributeError: status, reason = None, None except IOError, e: print " EXCEPTION: %s" % e raise else: print " status = %s, reason = %s" % (status, reason)
Example #4
Source File: openload.py From bugatsinho.github.io with GNU General Public License v3.0 | 6 votes |
def read_openload(url): default_headers = dict() default_headers[ "User-Agent"] = "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3163.100 Safari/537.36" default_headers["Accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" default_headers["Accept-Language"] = "es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3" default_headers["Accept-Charset"] = "UTF-8" default_headers["Accept-Encoding"] = "gzip" cj = cookielib.MozillaCookieJar() request_headers = default_headers.copy() url = urllib.quote(url, safe="%/:=&?~#+!$,;'@()*[]") handlers = [urllib2.HTTPHandler(debuglevel=False)] handlers.append(NoRedirectHandler()) handlers.append(urllib2.HTTPCookieProcessor(cj)) opener = urllib2.build_opener(*handlers) req = urllib2.Request(url, None, request_headers) handle = opener.open(req, timeout=None) return handle.headers.dict.get('location')
Example #5
Source File: openload.py From bugatsinho.github.io with GNU General Public License v3.0 | 6 votes |
def read_openload(url): default_headers = dict() default_headers[ "User-Agent"] = "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3163.100 Safari/537.36" default_headers["Accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" default_headers["Accept-Language"] = "es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3" default_headers["Accept-Charset"] = "UTF-8" default_headers["Accept-Encoding"] = "gzip" cj = cookielib.MozillaCookieJar() request_headers = default_headers.copy() url = urllib.quote(url, safe="%/:=&?~#+!$,;'@()*[]") handlers = [urllib2.HTTPHandler(debuglevel=False)] handlers.append(NoRedirectHandler()) handlers.append(urllib2.HTTPCookieProcessor(cj)) opener = urllib2.build_opener(*handlers) req = urllib2.Request(url, None, request_headers) handle = opener.open(req, timeout=None) return handle.headers.dict.get('location')
Example #6
Source File: openload.py From bugatsinho.github.io with GNU General Public License v3.0 | 6 votes |
def read_openload(url): default_headers = dict() default_headers[ "User-Agent"] = "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3163.100 Safari/537.36" default_headers["Accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" default_headers["Accept-Language"] = "es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3" default_headers["Accept-Charset"] = "UTF-8" default_headers["Accept-Encoding"] = "gzip" cj = cookielib.MozillaCookieJar() request_headers = default_headers.copy() url = urllib.quote(url, safe="%/:=&?~#+!$,;'@()*[]") handlers = [urllib2.HTTPHandler(debuglevel=False)] handlers.append(NoRedirectHandler()) handlers.append(urllib2.HTTPCookieProcessor(cj)) opener = urllib2.build_opener(*handlers) req = urllib2.Request(url, None, request_headers) handle = opener.open(req, timeout=None) return handle.headers.dict.get('location')
Example #7
Source File: hsecscan.py From hsecscan with GNU General Public License v2.0 | 6 votes |
def scan(url, redirect, insecure, useragent, postdata, proxy): request = urllib2.Request(url.geturl()) request.add_header('User-Agent', useragent) request.add_header('Origin', 'http://hsecscan.com') request.add_header('Accept', '*/*') if postdata: request.add_data(urllib.urlencode(postdata)) build = [urllib2.HTTPHandler()] if redirect: build.append(RedirectHandler()) if proxy: build.append(urllib2.ProxyHandler({'http': proxy, 'https': proxy})) if insecure: context = ssl._create_unverified_context() build.append(urllib2.HTTPSHandler(context=context)) urllib2.install_opener(urllib2.build_opener(*build)) response = urllib2.urlopen(request) print '>> RESPONSE INFO <<' print_response(response.geturl(), response.getcode(), response.info()) print '>> RESPONSE HEADERS DETAILS <<' for header in response.info().items(): check_header(header) print '>> RESPONSE MISSING HEADERS <<' missing_headers(response.info().items(), url.scheme)
Example #8
Source File: httphandler.py From lightbulb-framework with MIT License | 6 votes |
def __init__(self, configuration): self.setup(configuration) self.echo = None if "ECHO" in configuration: self.echo = configuration['ECHO'] if self.proxy_scheme is not None and self.proxy_host is not None and \ self.proxy_port is not None: credentials = "" if self.proxy_username is not None and self.proxy_password is not None: credentials = self.proxy_username + ":" + self.proxy_password + "@" proxyDict = { self.proxy_scheme: self.proxy_scheme + "://" + credentials + self.proxy_host + ":" + self.proxy_port } proxy = urllib2.ProxyHandler(proxyDict) if credentials != '': auth = urllib2.HTTPBasicAuthHandler() opener = urllib2.build_opener(proxy, auth, urllib2.HTTPHandler) else: opener = urllib2.build_opener(proxy) urllib2.install_opener(opener)
Example #9
Source File: keepalive.py From NoobSec-Toolkit with GNU General Public License v2.0 | 6 votes |
def error_handler(url): global HANDLE_ERRORS orig = HANDLE_ERRORS keepalive_handler = HTTPHandler() opener = urllib2.build_opener(keepalive_handler) urllib2.install_opener(opener) pos = {0: 'off', 1: 'on'} for i in (0, 1): print " fancy error handling %s (HANDLE_ERRORS = %i)" % (pos[i], i) HANDLE_ERRORS = i try: fo = urllib2.urlopen(url) foo = fo.read() fo.close() try: status, reason = fo.status, fo.reason except AttributeError: status, reason = None, None except IOError, e: print " EXCEPTION: %s" % e raise else: print " status = %s, reason = %s" % (status, reason)
Example #10
Source File: keepalive.py From NoobSec-Toolkit with GNU General Public License v2.0 | 6 votes |
def error_handler(url): global HANDLE_ERRORS orig = HANDLE_ERRORS keepalive_handler = HTTPHandler() opener = urllib2.build_opener(keepalive_handler) urllib2.install_opener(opener) pos = {0: 'off', 1: 'on'} for i in (0, 1): print " fancy error handling %s (HANDLE_ERRORS = %i)" % (pos[i], i) HANDLE_ERRORS = i try: fo = urllib2.urlopen(url) foo = fo.read() fo.close() try: status, reason = fo.status, fo.reason except AttributeError: status, reason = None, None except IOError, e: print " EXCEPTION: %s" % e raise else: print " status = %s, reason = %s" % (status, reason)
Example #11
Source File: keepalive.py From NoobSec-Toolkit with GNU General Public License v2.0 | 6 votes |
def comp(N, url): print ' making %i connections to:\n %s' % (N, url) sys.stdout.write(' first using the normal urllib handlers') # first use normal opener opener = urllib2.build_opener() urllib2.install_opener(opener) t1 = fetch(N, url) print ' TIME: %.3f s' % t1 sys.stdout.write(' now using the keepalive handler ') # now install the keepalive handler and try again opener = urllib2.build_opener(HTTPHandler()) urllib2.install_opener(opener) t2 = fetch(N, url) print ' TIME: %.3f s' % t2 print ' improvement factor: %.2f' % (t1/t2, )
Example #12
Source File: report_util.py From spore with MIT License | 6 votes |
def send_report(self, payload=None): if not payload: self.logger.debug('Timer triggered report') if self.msg_stack: payload = self.msg_stack.pop(-1) self.logger.debug('Timer triggered report') else: self.logger.debug('No more messages to send. Time stopped') self.timer.stop() return handler = urllib2.HTTPHandler() opener = urllib2.build_opener(handler) data = urllib.urlencode(payload) request = urllib2.Request(self.MAIL_URL, data=data) request.get_method = lambda: "POST" try: connection = opener.open(request) except urllib2.HTTPError, e: connection = e
Example #13
Source File: keepalive.py From NoobSec-Toolkit with GNU General Public License v2.0 | 6 votes |
def error_handler(url): global HANDLE_ERRORS orig = HANDLE_ERRORS keepalive_handler = HTTPHandler() opener = urllib2.build_opener(keepalive_handler) urllib2.install_opener(opener) pos = {0: 'off', 1: 'on'} for i in (0, 1): print " fancy error handling %s (HANDLE_ERRORS = %i)" % (pos[i], i) HANDLE_ERRORS = i try: fo = urllib2.urlopen(url) foo = fo.read() fo.close() try: status, reason = fo.status, fo.reason except AttributeError: status, reason = None, None except IOError, e: print " EXCEPTION: %s" % e raise else: print " status = %s, reason = %s" % (status, reason)
Example #14
Source File: LinkedInt.py From LinkedInt with GNU General Public License v3.0 | 6 votes |
def login(): cookie_filename = "cookies.txt" cookiejar = cookielib.MozillaCookieJar(cookie_filename) opener = urllib2.build_opener(urllib2.HTTPRedirectHandler(),urllib2.HTTPHandler(debuglevel=0),urllib2.HTTPSHandler(debuglevel=0),urllib2.HTTPCookieProcessor(cookiejar)) page = loadPage(opener, "https://www.linkedin.com/") parse = BeautifulSoup(page, "html.parser") csrf = parse.find(id="loginCsrfParam-login")['value'] login_data = urllib.urlencode({'session_key': username, 'session_password': password, 'loginCsrfParam': csrf}) page = loadPage(opener,"https://www.linkedin.com/uas/login-submit", login_data) parse = BeautifulSoup(page, "html.parser") cookie = "" try: cookie = cookiejar._cookies['.www.linkedin.com']['/']['li_at'].value except: sys.exit(0) cookiejar.save() os.remove(cookie_filename) return cookie
Example #15
Source File: reverseip.py From sqliv with GNU General Public License v3.0 | 6 votes |
def reverseip(url): """return domains from given the same server""" # get only domain name url = urlparse(url).netloc if urlparse(url).netloc != '' else urlparse(url).path.split("/")[0] source = "http://domains.yougetsignal.com/domains.php" useragent = useragents.get() contenttype = "application/x-www-form-urlencoded; charset=UTF-8" # POST method opener = urllib2.build_opener( urllib2.HTTPHandler(), urllib2.HTTPSHandler()) data = urllib.urlencode([('remoteAddress', url), ('key', '')]) request = urllib2.Request(source, data) request.add_header("Content-type", contenttype) request.add_header("User-Agent", useragent) try: result = urllib2.urlopen(request).read() except urllib2.HTTPError, e: print >> sys.stderr, "[{}] HTTP error".format(e.code)
Example #16
Source File: index.py From splunk-aws-project-trumpet with MIT License | 6 votes |
def sendResponse(event, context, responseStatus, responseData): responseBody = json.dumps({ "Status": responseStatus, "Reason": "See the details in CloudWatch Log Stream: " + context.log_stream_name, "PhysicalResourceId": context.log_stream_name, "StackId": event['StackId'], "RequestId": event['RequestId'], "LogicalResourceId": event['LogicalResourceId'], "Data": responseData }) logger.info('ResponseURL: {}'.format(event['ResponseURL'])) logger.info('ResponseBody: {}'.format(responseBody)) opener = build_opener(HTTPHandler) request = Request(event['ResponseURL'], data=responseBody) request.add_header('Content-Type', '') request.add_header('Content-Length', len(responseBody)) request.get_method = lambda: 'PUT' response = opener.open(request) print("Status code: {}".format(response.getcode())) print("Status message: {}".format(response.msg))
Example #17
Source File: index.py From splunk-aws-project-trumpet with MIT License | 6 votes |
def sendResponse(event, context, responseStatus, responseData): responseBody = json.dumps({ "Status": responseStatus, "Reason": "See the details in CloudWatch Log Stream: " + context.log_stream_name, "PhysicalResourceId": context.log_stream_name, "StackId": event['StackId'], "RequestId": event['RequestId'], "LogicalResourceId": event['LogicalResourceId'], "Data": responseData }) logger.info('ResponseURL: {}'.format(event['ResponseURL'])) logger.info('ResponseBody: {}'.format(responseBody)) opener = build_opener(HTTPHandler) request = Request(event['ResponseURL'], data=responseBody) request.add_header('Content-Type', '') request.add_header('Content-Length', len(responseBody)) request.get_method = lambda: 'PUT' response = opener.open(request) print("Status code: {}".format(response.getcode())) print("Status message: {}".format(response.msg))
Example #18
Source File: index.py From splunk-aws-project-trumpet with MIT License | 6 votes |
def sendResponse(event, context, responseStatus, responseData): responseBody = json.dumps({ "Status": responseStatus, "Reason": "See the details in CloudWatch Log Stream: " + context.log_stream_name, "PhysicalResourceId": context.log_stream_name, "StackId": event['StackId'], "RequestId": event['RequestId'], "LogicalResourceId": event['LogicalResourceId'], "Data": responseData }) logger.info('ResponseURL: {}'.format(event['ResponseURL'])) logger.info('ResponseBody: {}'.format(responseBody)) opener = build_opener(HTTPHandler) request = Request(event['ResponseURL'], data=responseBody) request.add_header('Content-Type', '') request.add_header('Content-Length', len(responseBody)) request.get_method = lambda: 'PUT' response = opener.open(request) print("Status code: {}".format(response.getcode())) print("Status message: {}".format(response.msg))
Example #19
Source File: index.py From splunk-aws-project-trumpet with MIT License | 6 votes |
def sendResponse(event, context, responseStatus, responseData): responseBody = json.dumps({ "Status": responseStatus, "Reason": "See the details in CloudWatch Log Stream: " + context.log_stream_name, "PhysicalResourceId": context.log_stream_name, "StackId": event['StackId'], "RequestId": event['RequestId'], "LogicalResourceId": event['LogicalResourceId'], "Data": responseData }) logger.info('ResponseURL: {}'.format(event['ResponseURL'])) logger.info('ResponseBody: {}'.format(responseBody)) opener = build_opener(HTTPHandler) request = Request(event['ResponseURL'], data=responseBody) request.add_header('Content-Type', '') request.add_header('Content-Length', len(responseBody)) request.get_method = lambda: 'PUT' response = opener.open(request) print("Status code: {}".format(response.getcode())) print("Status message: {}".format(response.msg))
Example #20
Source File: index.py From splunk-aws-project-trumpet with MIT License | 6 votes |
def sendResponse(event, context, responseStatus, responseData): responseBody = json.dumps({ "Status": responseStatus, "Reason": "See the details in CloudWatch Log Stream: " + context.log_stream_name, "PhysicalResourceId": context.log_stream_name, "StackId": event['StackId'], "RequestId": event['RequestId'], "LogicalResourceId": event['LogicalResourceId'], "Data": responseData }) logger.info('ResponseURL: {}'.format(event['ResponseURL'])) logger.info('ResponseBody: {}'.format(responseBody)) opener = build_opener(HTTPHandler) request = Request(event['ResponseURL'], data=responseBody) request.add_header('Content-Type', '') request.add_header('Content-Length', len(responseBody)) request.get_method = lambda: 'PUT' response = opener.open(request) print("Status code: {}".format(response.getcode())) print("Status message: {}".format(response.msg))
Example #21
Source File: index.py From splunk-aws-project-trumpet with MIT License | 6 votes |
def sendResponse(event, context, responseStatus, responseData): responseBody = json.dumps({ "Status": responseStatus, "Reason": "See the details in CloudWatch Log Stream: " + context.log_stream_name, "PhysicalResourceId": context.log_stream_name, "StackId": event['StackId'], "RequestId": event['RequestId'], "LogicalResourceId": event['LogicalResourceId'], "Data": responseData }) logger.info('ResponseURL: {}'.format(event['ResponseURL'])) logger.info('ResponseBody: {}'.format(responseBody)) opener = build_opener(HTTPHandler) request = Request(event['ResponseURL'], data=responseBody) request.add_header('Content-Type', '') request.add_header('Content-Length', len(responseBody)) request.get_method = lambda: 'PUT' response = opener.open(request) print("Status code: {}".format(response.getcode())) print("Status message: {}".format(response.msg))
Example #22
Source File: index.py From splunk-aws-project-trumpet with MIT License | 6 votes |
def sendResponse(event, context, responseStatus, responseData): responseBody = json.dumps({ "Status": responseStatus, "Reason": "See the details in CloudWatch Log Stream: " + context.log_stream_name, "PhysicalResourceId": context.log_stream_name, "StackId": event['StackId'], "RequestId": event['RequestId'], "LogicalResourceId": event['LogicalResourceId'], "Data": responseData }) logger.info('ResponseURL: {}'.format(event['ResponseURL'])) logger.info('ResponseBody: {}'.format(responseBody)) opener = build_opener(HTTPHandler) request = Request(event['ResponseURL'], data=responseBody) request.add_header('Content-Type', '') request.add_header('Content-Length', len(responseBody)) request.get_method = lambda: 'PUT' response = opener.open(request) print("Status code: {}".format(response.getcode())) print("Status message: {}".format(response.msg))
Example #23
Source File: prep.py From dart with Apache License 2.0 | 6 votes |
def download_vcpython27(self): """ Download vcpython27 since some Windows 7 boxes have it and some don't. :return: None """ self._prepare_for_download() logger.info('Beginning download of vcpython27... this may take a few minutes...') with open(os.path.join(DOWNLOADS_DIR, 'vcpython27.msi'), 'wb') as f: if self.PROXY is not None: opener = urllib2.build_opener( urllib2.HTTPHandler(), urllib2.HTTPSHandler(), urllib2.ProxyHandler({'http': self.PROXY, 'https': self.PROXY}) ) urllib2.install_opener(opener) f.write(urllib2.urlopen(self.VCPYTHON27_DOWNLOAD_URL, timeout=self.DOWNLOAD_TIMEOUT).read()) logger.debug('Download of vcpython27 complete')
Example #24
Source File: prep.py From dart with Apache License 2.0 | 6 votes |
def download_python(self): """ Download Python :return: None """ self._prepare_for_download() logger.info('Beginning download of python') with open(os.path.join(DOWNLOADS_DIR, 'python-installer.msi'), 'wb') as f: if self.PROXY is not None: opener = urllib2.build_opener( urllib2.HTTPHandler(), urllib2.HTTPSHandler(), urllib2.ProxyHandler({'http': self.PROXY, 'https': self.PROXY}) ) urllib2.install_opener(opener) f.write(urllib2.urlopen(self.PYTHON_DOWNLOAD_URL, timeout=self.DOWNLOAD_TIMEOUT).read()) logger.debug('Download of python complete')
Example #25
Source File: check_proxy.py From crawler with MIT License | 6 votes |
def check_gn_proxy(proxy, protocal_type='HTTP'): url = 'http://icanhazip.com' proxy_handler = urllib2.ProxyHandler({ 'http': 'http://' + proxy, 'https': 'https://' + proxy, }) if protocal_type == 'HTTPS': url = 'https://icanhazip.com' opener = urllib2.build_opener(proxy_handler, urllib2.HTTPHandler) try: response = opener.open(url, timeout=3) res_ip = response.read().strip() return response.code == 200 and res_ip == proxy.split(':')[0] except Exception: return False
Example #26
Source File: wphttp.py From Yuki-Chan-The-Auto-Pentest with MIT License | 5 votes |
def send(self,url,method='GET',payload=None,headers=None,cookie=None): if payload is None: payload = {} if headers is None: headers = {} # add user-agent headers['User-agent'] = self.agent handlers = [urllib2.HTTPHandler(),urllib2.HTTPSHandler()] if cookie != None: handlers.append(urllib2.HTTPCookieProcessor(cookie)) if self.redirect == False: handlers.append(NoredirectHandler()) if self.proxy: proxies = {'http':self.proxy,'https':self.proxy} handlers.append(urllib2.ProxyHandler(proxies)) # build opener opener = urllib2.build_opener(*handlers) urllib2.install_opener(opener) if method == 'GET': if payload: url = "%s"%check().checkpayload(url,payload) req = urllib2.Request(url,headers=headers) if method == 'POST': req = urllib2.Request(url,data=payload,headers=headers) try: resp = urllib2.urlopen(req) except urllib2.HTTPError as err: resp = err return resp
Example #27
Source File: sockshandler.py From Google-Alfred3-Workflow with MIT License | 5 votes |
def __init__(self, *args, **kwargs): self.args = args self.kw = kwargs urllib2.HTTPHandler.__init__(self)
Example #28
Source File: wphttp.py From ITWSV with MIT License | 5 votes |
def send(self,url,method='GET',payload=None,headers=None,cookie=None): if payload is None: payload = {} if headers is None: headers = {} # add user-agent headers['User-agent'] = self.agent handlers = [urllib2.HTTPHandler(),urllib2.HTTPSHandler()] if cookie != None: handlers.append(urllib2.HTTPCookieProcessor(cookie)) if self.redirect == False: handlers.append(NoredirectHandler()) if self.proxy: proxies = {'http':self.proxy,'https':self.proxy} handlers.append(urllib2.ProxyHandler(proxies)) # build opener opener = urllib2.build_opener(*handlers) urllib2.install_opener(opener) if method == 'GET': if payload: url = "%s"%check().checkpayload(url,payload) req = urllib2.Request(url,headers=headers) if method == 'POST': req = urllib2.Request(url,data=payload,headers=headers) try: resp = urllib2.urlopen(req) except urllib2.HTTPError as err: resp = err return resp
Example #29
Source File: sockshandler.py From script.elementum.burst with Do What The F*ck You Want To Public License | 5 votes |
def __init__(self, *args, **kwargs): self.args = args self.kw = kwargs urllib2.HTTPHandler.__init__(self)
Example #30
Source File: sockshandler.py From scalyr-agent-2 with Apache License 2.0 | 5 votes |
def __init__(self, *args, **kwargs): self.args = args self.kw = kwargs urllib2.HTTPHandler.__init__(self)