def _start_browsing_page(self, browser, message, client_id, url, parent_url_metadata, behavior_parameters):
        def on_response(chrome_msg):
            if (chrome_msg['params']['response']['url'].lower().startswith('data:')
                    or chrome_msg['params']['response']['fromDiskCache']
                    or not 'requestHeaders' in chrome_msg['params']['response']):
                return

            payload = {
                'url': chrome_msg['params']['response']['url'],
                'headers': chrome_msg['params']['response']['requestHeaders'],
                'parentUrl': url,
                'parentUrlMetadata': parent_url_metadata,
            }

            if chrome_msg['params']['response']['requestHeaders'] in ':method':
                # happens when http transaction is http 2.0
                payload['method'] = chrome_msg['params']['response']['requestHeaders'][':method']
            elif 'requestHeadersText' in chrome_msg['params']['response']:
                req = chrome_msg['params']['response']['requestHeadersText']
                payload['method'] = req[:req.index(' ')]
            else:
                self.logger.warn('unable to identify http method (assuming GET) chrome_msg=%s',
                                 chrome_msg)
                payload['method'] = 'GET'

            self.logger.debug(
                    'sending to amqp exchange=%s routing_key=%s payload=%s',
                    self.exchange_name, client_id, payload)
            with self._producer_lock:
                publish = self._producer_conn.ensure(self._producer,
                                                     self._producer.publish)
                publish(payload, exchange=self._exchange, routing_key=client_id)

        def browse_page_sync():
            self.logger.info(
                    'browser=%s client_id=%s url=%s behavior_parameters=%s',
                    browser, client_id, url, behavior_parameters)
            try:
                browser.browse_page(url, on_response=on_response,
                                    behavior_parameters=behavior_parameters)
                message.ack()
            except BrowsingException as e:
                self.logger.warn("browsing did not complete normally, requeuing url {} - {}".format(url, e))
                message.requeue()
            except:
                self.logger.critical("problem browsing page, requeuing url {}, may have lost browser process".format(url), exc_info=True)
                message.requeue()
            finally:
                browser.stop()
                self._browser_pool.release(browser)

        def browse_thread_run_then_cleanup():
            browse_page_sync()
            with self._browsing_threads_lock:
                self._browsing_threads.remove(threading.current_thread())

        import random
        thread_name = "BrowsingThread{}-{}".format(browser.chrome_port,
                ''.join((random.choice('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789') for _ in range(6))))
        th = threading.Thread(target=browse_thread_run_then_cleanup, name=thread_name)
        with self._browsing_threads_lock:
            self._browsing_threads.add(th)
        th.start()
dataset/ETHPy150Open internetarchive/umbra/umbra/controller.py/AmqpBrowserController._start_browsing_page/swapped operands of `in`