How to use get_origin_host method in localstack

Best Python code snippet using localstack_python

reports.py

Source:reports.py Github

copy

Full Screen

...21 def process(self, spider):22 self._process_overall(spider)23 self._process_pages(spider)24 def _process_pages(self, spider):25 host = spider.get_origin_host()26 fire = Firebase('%s/pages/%s' % (self.fire_host, host))27 origin_hash = url_hash(host)28 cursor = self.db.cursor()29 query = """30SELECT content_item_id31 , content_node_id32 , object_type33 , lint_critical34 , lint_error35 , lint_warn36 , lint_info37 , lint_results38 FROM page39 WHERE request_method = 'GET'40 AND external = 041 AND object_type IS NOT NULL42 AND content_item_id IS NOT NULL43 ORDER BY lint_critical DESC, lint_error DESC, lint_warn DESC44 LIMIT 2045 """46 cursor.execute(query)47 rows = cursor.fetchall()48 res = {}49 for row in rows:50 res[row.pop('content_item_id')] = row51 fire.update(res)52 def _process_overall(self, spider):53 host = spider.get_origin_host()54 fire = Firebase('%s/reports/%s/%s' % (self.fire_host, host,55 datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S')))56 origin_hash = url_hash(host)57 cursor = self.db.cursor()58 query = """59SELECT COUNT(1) AS pages60 , AVG(p.response_time) AS avg_response_time61 , AVG(p.response_time + al.total_response_time) AS avg_total_response_time62 , AVG(LENGTH(p.body)) AS avg_page_size63 , AVG(LENGTH(p.body) + al.total_size) AS avg_total_page_size64 , SUM(p.lint_critical) AS total_lint_critical65 , SUM(p.lint_error) AS total_lint_error66 , SUM(p.lint_warn) AS total_lint_warn67 , SUM(p.lint_info) AS total_lint_info...

Full Screen

Full Screen

test_settings.py

Source:test_settings.py Github

copy

Full Screen

...43 def test_raise_exception_when_origin_host_is_not_defined(44 self, settings):45 del(settings.POSTOFFICE['ORIGIN_HOST'])46 with pytest.raises(OriginHostSettingNotDefined):47 get_origin_host()48 def test_raise_exception_when_topics_is_not_defined(49 self, settings, caplog):50 del(settings.POSTOFFICE['TOPICS'])51 assert get_topics() == []52 assert (53 'postoffice_django.settings',54 logging.WARNING,55 'Topics config key is missing'...

Full Screen

Full Screen

middleware.py

Source:middleware.py Github

copy

Full Screen

...22 return response23class OriginHostMiddleware(object):24 def process_request(self, request, spider):25 if hasattr(spider, 'get_origin_host'):26 request.meta['origin_host'] = spider.get_origin_host()27class ErrorConverterMiddleware(object):28 def process_exception(self, request, exception, spider):...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful