scrapinghub / portia

Visual scraping for Scrapy
BSD 3-Clause "New" or "Revised" License
9.3k stars 1.4k forks source link

ConnectionError: HTTPConnectionPool(host='localhost', port=6800): Max retries exceeded #786

Closed rootinshell closed 7 years ago

rootinshell commented 7 years ago
Internal Server Error: /api/projects/projectx/spiders/website.foo/schedule
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py                                                                                   ", line 39, in inner response = get_response(request)
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/csrf.py",                                                                                         line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/rest_framework/viewsets.py", line87, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py", line185, in inner
    return func(*args, **kwargs)
  File "/app/portia_server/portia_api/resources/route.py", line 74, in dispatch
    return super(JsonApiRoute, self).dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/rest_framework/views.py", line 466, in dispatch
    response = self.handle_exception(exc)
  File "/app/portia_server/portia_api/resources/route.py", line 77, in handle_exception
    response = super(JsonApiRoute, self).handle_exception(exc)
  File "/usr/local/lib/python2.7/dist-packages/rest_framework/views.py", line 463, in dispatch
    response = handler(request, *args, **kwargs)
  File "/app/portia_server/portia_api/resources/spiders.py", line 82, in schedule
    request = requests.post(settings.SCHEDULE_URL, data=schedule_data)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 110, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 488,in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 609,in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 487,in send raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='localhost', port=6800): Max retries exceeded with url: /schedule.json (Caused by NewConnectionError('<requests.package                                                                                        s.urllib3.connection.HTTPConnection object at 0x7f0211408c90>: Failed to establish a new connection: [Errno 111] Connection refused',))
[22/Apr/2017 18:19:18] "POST /api/projects/projectx/spiders/website.foo/schedule HTTP/1.0" 500 15002

any idea about the root cause ? i had the same situation using docker on a windows environnement, and ubuntu on AWS.

rootinshell commented 7 years ago

Solved, better run spider using docker command line, the error is because scrapyd was missing.

HartOfWave commented 7 years ago

I am having this same issue running docker2boot, how did you resolve this?

LexiconCode commented 7 years ago

@rootinshell can you post details about your workaround?

majidshokrolahi commented 6 years ago

I have included scrapyd and still i see the same error. what should i do ?

simons1321 commented 6 years ago

@LexiconCode he means using the docker command to start the spiders:

docker run -i -t --rm -v <PROJECTS_FOLDER>:/app/data/projects:rw -v <OUPUT_FOLDER>:/mnt:rw -p 9001:9001 scrapinghub/portia \
    portiacrawl /app/data/projects/PROJECT_NAME SPIDER_NAME -o /mnt/SPIDER_NAME.jl