Merhabalar. Bir webscraper yazdım. Bu webscraper veriyi alıp containerda çalışan rabbit’e yazıyor fakat webscraper’ı container’a attığımda buradan rabbitmq’ya bağlanamıyorum. normal bir şekilde çalıştırdığımda bağlanabilen scraper, containerda bağlanamıyor. internette network oluşturup ikisini aynı network’e koymalısınız yazıyor fakat bunu da denedim hâlâ bağlanamıyorum.
aldığım hata:
2023-03-02 14:58:22 [scrapy.middleware] INFO: Enabled item pipelines:
['interpol.pipelines.RabbitMQPipeline']
2023-03-02 14:58:22 [scrapy.core.engine] INFO: Spider opened
2023-03-02 14:58:22 [pika.adapters.select_connection] DEBUG: Using EPollPoller
2023-03-02 14:58:22 [pika.adapters.base_connection] DEBUG: Created default connection workflow <pika.adapters.utils.connection_workflow.AMQPConnectionWorkflow object at 0x7f01e7e89550>
2023-03-02 14:58:22 [pika.adapters.utils.connection_workflow] DEBUG: Starting AMQP Connection workflow asynchronously.
2023-03-02 14:58:22 [pika.adapters.select_connection] DEBUG: call_later: added timeout <pika.adapters.select_connection._Timeout object at 0x7f01e7e89580> with deadline=11147.406463 and callback=functools.partial(<bound method AMQPConnectionWorkflow._start_new_cycle_async of <pika.adapters.utils.connection_workflow.AMQPConnectionWorkflow object at 0x7f01e7e89550>>, first=True); now=11147.406463; delay=0
2023-03-02 14:58:22 [pika.adapters.utils.connection_workflow] DEBUG: Beginning a new AMQP connection workflow cycle; attempts remaining after this: 0
2023-03-02 14:58:22 [pika.adapters.select_connection] DEBUG: call_later: added timeout <pika.adapters.select_connection._Timeout object at 0x7f01e7e895e0> with deadline=11147.4069337 and callback=<bound method AMQPConnectionWorkflow._try_next_config_async of <pika.adapters.utils.connection_workflow.AMQPConnectionWorkflow object at 0x7f01e7e89550>>; now=11147.4069337; delay=0
2023-03-02 14:58:22 [pika.adapters.utils.connection_workflow] DEBUG: _try_next_config_async: 'localhost':5672
2023-03-02 14:58:22 [pika.adapters.select_connection] DEBUG: add_callback_threadsafe: added callback=<bound method _AddressResolver._dispatch_result of <pika.adapters.utils.selector_ioloop_adapter._AddressResolver object at 0x7f01e7e896a0>>
2023-03-02 14:58:22 [pika.adapters.select_connection] DEBUG: process_timeouts: invoking callback=<bound method _AddressResolver._dispatch_result of <pika.adapters.utils.selector_ioloop_adapter._AddressResolver object at 0x7f01e7e896a0>>
2023-03-02 14:58:22 [pika.adapters.utils.selector_ioloop_adapter] DEBUG: Invoking asynchronous getaddrinfo() completion callback; host='localhost'
2023-03-02 14:58:22 [pika.adapters.utils.connection_workflow] DEBUG: getaddrinfo returned 2 records
2023-03-02 14:58:22 [pika.adapters.utils.connection_workflow] DEBUG: Attempting to connect using address record (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('127.0.0.1', 5672))
2023-03-02 14:58:22 [pika.adapters.utils.connection_workflow] INFO: Pika version 1.3.1 connecting to ('127.0.0.1', 5672)
2023-03-02 14:58:22 [pika.adapters.select_connection] DEBUG: add_callback_threadsafe: added callback=<bound method _AsyncSocketConnector._start_async of <pika.adapters.utils.io_services_utils._AsyncSocketConnector object at 0x7f01e7e899d0>>
2023-03-02 14:58:22 [pika.adapters.select_connection] DEBUG: call_later: added timeout <pika.adapters.select_connection._Timeout object at 0x7f01e7e89b80> with deadline=11157.410385 and callback=<bound method AMQPConnector._on_tcp_connection_timeout of <pika.adapters.utils.connection_workflow.AMQPConnector object at 0x7f01e7e89b20>>; now=11147.410385; delay=10.0
2023-03-02 14:58:22 [pika.adapters.select_connection] DEBUG: call_later: added timeout <pika.adapters.select_connection._Timeout object at 0x7f01e7e895e0> with deadline=11162.4105109 and callback=<bound method AMQPConnector._on_overall_timeout of <pika.adapters.utils.connection_workflow.AMQPConnector object at 0x7f01e7e89b20>>; now=11147.4105109; delay=15.0
2023-03-02 14:58:22 [pika.adapters.select_connection] DEBUG: process_timeouts: invoking callback=<bound method _AsyncSocketConnector._start_async of <pika.adapters.utils.io_services_utils._AsyncSocketConnector object at 0x7f01e7e899d0>>
2023-03-02 14:58:22 [pika.adapters.utils.selector_ioloop_adapter] DEBUG: SelectorIOServicesAdapter.set_writer(11, <bound method _AsyncSocketConnector._on_writable of <pika.adapters.utils.io_services_utils._AsyncSocketConnector object at 0x7f01e7e899d0>>)
2023-03-02 14:58:22 [pika.adapters.utils.selector_ioloop_adapter] DEBUG: set_writer(11, _) added handler Wr
2023-03-02 14:58:22 [pika.adapters.utils.io_services_utils] DEBUG: Connection-establishment is in progress for <socket.socket fd=11, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 58818)>.
2023-03-02 14:58:22 [pika.adapters.utils.io_services_utils] ERROR: Socket failed to connect: <socket.socket fd=11, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 58818)>; error=111 (Connection refused)
2023-03-02 14:58:22 [pika.adapters.utils.io_services_utils] DEBUG: _AsyncSocketConnector._report_completion(ConnectionRefusedError(111, 'Connection refused')); <socket.socket fd=11, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 58818)>
2023-03-02 14:58:22 [pika.adapters.utils.selector_ioloop_adapter] DEBUG: SelectorIOServicesAdapter.remove_writer(11)
2023-03-02 14:58:22 [pika.adapters.utils.selector_ioloop_adapter] DEBUG: remove_writer(11) removed handler
2023-03-02 14:58:22 [pika.adapters.select_connection] DEBUG: remove_timeout: removing timeout <pika.adapters.select_connection._Timeout object at 0x7f01e7e89b80> with deadline=11157.410385 and callback=<bound method AMQPConnector._on_tcp_connection_timeout of <pika.adapters.utils.connection_workflow.AMQPConnector object at 0x7f01e7e89b20>>
2023-03-02 14:58:22 [pika.adapters.utils.connection_workflow] ERROR: TCP Connection attempt failed: ConnectionRefusedError(111, 'Connection refused'); dest=(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('127.0.0.1', 5672))
2023-03-02 14:58:22 [pika.adapters.utils.connection_workflow] ERROR: AMQPConnector - reporting failure: AMQPConnectorSocketConnectError: ConnectionRefusedError(111, 'Connection refused')
2023-03-02 14:58:22 [pika.adapters.select_connection] DEBUG: remove_timeout: removing timeout <pika.adapters.select_connection._Timeout object at 0x7f01e7e895e0> with deadline=11162.4105109 and callback=<bound method AMQPConnector._on_overall_timeout of <pika.adapters.utils.connection_workflow.AMQPConnector object at 0x7f01e7e89b20>>
2023-03-02 14:58:22 [pika.adapters.utils.connection_workflow] DEBUG: Connection attempt completed with AMQPConnectorSocketConnectError: ConnectionRefusedError(111, 'Connection refused')
2023-03-02 14:58:22 [pika.adapters.utils.connection_workflow] DEBUG: Attempting to connect using address record (<AddressFamily.AF_INET6: 10>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('::1', 5672, 0, 0))
2023-03-02 14:58:22 [pika.adapters.utils.connection_workflow] INFO: Pika version 1.3.1 connecting to ('::1', 5672, 0, 0)
2023-03-02 14:58:22 [pika.adapters.select_connection] DEBUG: add_callback_threadsafe: added callback=<bound method _AsyncSocketConnector._start_async of <pika.adapters.utils.io_services_utils._AsyncSocketConnector object at 0x7f01e7e89be0>>
2023-03-02 14:58:22 [pika.adapters.select_connection] DEBUG: call_later: added timeout <pika.adapters.select_connection._Timeout object at 0x7f01e7e89670> with deadline=11157.4138362 and callback=<bound method AMQPConnector._on_tcp_connection_timeout of <pika.adapters.utils.connection_workflow.AMQPConnector object at 0x7f01e7e89bb0>>; now=11147.4138362; delay=10.0
2023-03-02 14:58:22 [pika.adapters.select_connection] DEBUG: call_later: added timeout <pika.adapters.select_connection._Timeout object at 0x7f01e7e89940> with deadline=11162.4139837 and callback=<bound method AMQPConnector._on_overall_timeout of <pika.adapters.utils.connection_workflow.AMQPConnector object at 0x7f01e7e89bb0>>; now=11147.4139837; delay=15.0
2023-03-02 14:58:22 [pika.adapters.select_connection] DEBUG: process_timeouts: invoking callback=<bound method _AsyncSocketConnector._start_async of <pika.adapters.utils.io_services_utils._AsyncSocketConnector object at 0x7f01e7e89be0>>
2023-03-02 14:58:22 [pika.adapters.utils.io_services_utils] ERROR: <socket.socket fd=11, family=AddressFamily.AF_INET6, type=SocketKind.SOCK_STREAM, proto=6, laddr=('::', 0, 0, 0)>.connect(('::1', 5672, 0, 0)) failed: OSError(99, 'Cannot assign requested address')
2023-03-02 14:58:22 [pika.adapters.utils.io_services_utils] DEBUG: _AsyncSocketConnector._report_completion(OSError(99, 'Cannot assign requested address')); <socket.socket fd=11, family=AddressFamily.AF_INET6, type=SocketKind.SOCK_STREAM, proto=6, laddr=('::', 0, 0, 0)>
2023-03-02 14:58:22 [pika.adapters.select_connection] DEBUG: remove_timeout: removing timeout <pika.adapters.select_connection._Timeout object at 0x7f01e7e89670> with deadline=11157.4138362 and callback=<bound method AMQPConnector._on_tcp_connection_timeout of <pika.adapters.utils.connection_workflow.AMQPConnector object at 0x7f01e7e89bb0>>
2023-03-02 14:58:22 [pika.adapters.utils.connection_workflow] ERROR: TCP Connection attempt failed: OSError(99, 'Cannot assign requested address'); dest=(<AddressFamily.AF_INET6: 10>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('::1', 5672, 0, 0))
2023-03-02 14:58:22 [pika.adapters.utils.connection_workflow] ERROR: AMQPConnector - reporting failure: AMQPConnectorSocketConnectError: OSError(99, 'Cannot assign requested address')
2023-03-02 14:58:22 [pika.adapters.select_connection] DEBUG: remove_timeout: removing timeout <pika.adapters.select_connection._Timeout object at 0x7f01e7e89940> with deadline=11162.4139837 and callback=<bound method AMQPConnector._on_overall_timeout of <pika.adapters.utils.connection_workflow.AMQPConnector object at 0x7f01e7e89bb0>>
2023-03-02 14:58:22 [pika.adapters.utils.connection_workflow] DEBUG: Connection attempt completed with AMQPConnectorSocketConnectError: OSError(99, 'Cannot assign requested address')
2023-03-02 14:58:22 [pika.adapters.utils.connection_workflow] DEBUG: _try_next_resolved_address: continuing with next config.
2023-03-02 14:58:22 [pika.adapters.utils.connection_workflow] DEBUG: _try_next_config_async: starting a new cycle.
2023-03-02 14:58:22 [pika.adapters.utils.connection_workflow] ERROR: AMQP connection workflow failed: AMQPConnectionWorkflowFailed: 2 exceptions in all; last exception - AMQPConnectorSocketConnectError: OSError(99, 'Cannot assign requested address'); first exception - AMQPConnectorSocketConnectError: ConnectionRefusedError(111, 'Connection refused').
2023-03-02 14:58:22 [pika.adapters.utils.connection_workflow] ERROR: AMQPConnectionWorkflow - reporting failure: AMQPConnectionWorkflowFailed: 2 exceptions in all; last exception - AMQPConnectorSocketConnectError: OSError(99, 'Cannot assign requested address'); first exception - AMQPConnectorSocketConnectError: ConnectionRefusedError(111, 'Connection refused')
2023-03-02 14:58:22 [pika.adapters.blocking_connection] ERROR: Connection workflow failed: AMQPConnectionWorkflowFailed: 2 exceptions in all; last exception - AMQPConnectorSocketConnectError: OSError(99, 'Cannot assign requested address'); first exception - AMQPConnectorSocketConnectError: ConnectionRefusedError(111, 'Connection refused')
2023-03-02 14:58:22 [pika.adapters.blocking_connection] ERROR: Error in _create_connection().
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/pika/adapters/blocking_connection.py", line 451, in _create_connection
raise self._reap_last_connection_workflow_error(error)
pika.exceptions.AMQPConnectionError
2023-03-02 14:58:22 [scrapy.core.engine] INFO: Closing spider (shutdown)
2023-03-02 14:58:22 [scrapy.core.engine] ERROR: Scraper close failure
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/scrapy/crawler.py", line 124, in crawl
yield self.engine.open_spider(self.spider, start_requests)
pika.exceptions.AMQPConnectionError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/twisted/internet/defer.py", line 892, in _runCallbacks
current.result = callback( # type: ignore[misc]
File "/usr/src/app/interpol/pipelines.py", line 23, in close_spider
self._channel.close()
AttributeError: 'RabbitMQPipeline' object has no attribute '_channel'
2023-03-02 14:58:22 [scrapy.utils.signal] ERROR: Error caught on signal handler: <bound method CoreStats.spider_closed of <scrapy.extensions.corestats.CoreStats object at 0x7f01e8658af0>>
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/scrapy/crawler.py", line 124, in crawl
yield self.engine.open_spider(self.spider, start_requests)
pika.exceptions.AMQPConnectionError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/scrapy/utils/defer.py", line 312, in maybeDeferred_coro
result = f(*args, **kw)
File "/usr/local/lib/python3.8/dist-packages/pydispatch/robustapply.py", line 55, in robustApply
return receiver(*arguments, **named)
File "/usr/local/lib/python3.8/dist-packages/scrapy/extensions/corestats.py", line 30, in spider_closed
elapsed_time = finish_time - self.start_time
TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 'NoneType'
2023-03-02 14:58:22 [scrapy.statscollectors] INFO: Dumping Scrapy stats:
{'log_count/DEBUG': 39, 'log_count/ERROR': 12, 'log_count/INFO': 10}
2023-03-02 14:58:22 [scrapy.core.engine] INFO: Spider closed (shutdown)
Unhandled error in Deferred:
2023-03-02 14:58:22 [twisted] CRITICAL: Unhandled error in Deferred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/scrapy/crawler.py", line 233, in crawl
return self._crawl(crawler, *args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/scrapy/crawler.py", line 237, in _crawl
d = crawler.crawl(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/twisted/internet/defer.py", line 1947, in unwindGenerator
return _cancellableInlineCallbacks(gen)
File "/usr/local/lib/python3.8/dist-packages/twisted/internet/defer.py", line 1857, in _cancellableInlineCallbacks
_inlineCallbacks(None, gen, status, _copy_context())
--- <exception caught here> ---
File "/usr/local/lib/python3.8/dist-packages/twisted/internet/defer.py", line 1697, in _inlineCallbacks
result = context.run(gen.send, result)
File "/usr/local/lib/python3.8/dist-packages/scrapy/crawler.py", line 124, in crawl
yield self.engine.open_spider(self.spider, start_requests)
pika.exceptions.AMQPConnectionError:
2023-03-02 14:58:22 [twisted] CRITICAL:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/twisted/internet/defer.py", line 1697, in _inlineCallbacks
result = context.run(gen.send, result)
File "/usr/local/lib/python3.8/dist-packages/scrapy/crawler.py", line 124, in crawl
yield self.engine.open_spider(self.spider, start_requests)
pika.exceptions.AMQPConnectionError