Skip to content

Commit

Permalink
fixed small bug, fixed naming, updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
eracle committed Mar 23, 2020
1 parent 9fef516 commit ad096ce
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ sudo apt-get install vinagre
Copy `conf_template.py` in `conf.py` and fill the quotes with your credentials.

###### 2. Run and build containers with docker-compose:
Only linkedin spider, not the companies spider.
Only linkedin random spider, not the companies spider.
Open your terminal, move to the project folder and type:

```bash
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3'
services:
web:
command: ["./wait-for-selenium.sh", "http://selenium:4444/wd/hub", "--", "scrapy", "crawl", "linkedin"]
scrapy:
command: ["./wait-for-selenium.sh", "http://selenium:4444/wd/hub", "--", "scrapy", "crawl", "random"]
environment:
- PYTHONUNBUFFERED=0
build:
Expand Down
6 changes: 4 additions & 2 deletions linkedin/spiders/search.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import copy
import time

from scrapy import Spider
from scrapy import Request
from scrapy import Spider

from linkedin.spiders.selenium import get_by_xpath_or_none, SeleniumSpiderMixin


"""
Number of seconds to wait checking if the page is a "No Result" type.
"""
Expand Down Expand Up @@ -57,7 +59,7 @@ def parser_search_results_page(self, response):

yield Request(url=next_url,
callback=self.parser_search_results_page,
meta=response.meta,
meta=copy.deepcopy(response.meta),
dont_filter=True,
)

Expand Down
4 changes: 4 additions & 0 deletions linkedin/tests/selenium.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import unittest

import pytest

from linkedin.spiders.selenium import init_chromium, login


Expand All @@ -15,10 +17,12 @@ def tearDown(self):

class ChromiumTest(SeleniumTest):

@pytest.mark.skip
def test_init(self):
self.assertIsNotNone(self.driver)
print("type: %s" % type(self.driver))

@pytest.mark.skip
def test_login(self):
login(self.driver)

Expand Down
6 changes: 1 addition & 5 deletions requirements/production.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ Scrapy>=1.5.1 # pyup: < 2.0 # https://github.com/scrapy/scrapy

# Selenium
selenium>=3.14.0 # pyup: < 4.0 # https://github.com/SeleniumHQ/selenium

# Testing
# todo: move them to a dedicated req file
pytest==5.4.1
pytest-sugar==0.9.2
scrapy-selenium==0.0.7

# Linkedin API library
-e git+https://github.com/tomquirk/linkedin-api.git@f5962d05e92d135b1be21146a5ce9d41eaf6d423#egg=linkedin_api
3 changes: 3 additions & 0 deletions requirements/testing.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Testing
pytest==5.4.1
pytest-sugar==0.9.2

0 comments on commit ad096ce

Please sign in to comment.