forked from eracle/linkedin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
linkedin crawler now leverages linkedin-api functionalities
- Loading branch information
Showing
7 changed files
with
92 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,5 @@ selenium_prototype.py | |
.pytest_cache/ | ||
interactive.py | ||
users.csv | ||
.vscode | ||
.dockerignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from time import sleep | ||
|
||
import random | ||
from linkedin_api import Linkedin | ||
|
||
|
||
def my_default_evade(): | ||
""" | ||
A catch-all method to try and evade suspension from Linkedin. | ||
Currenly, just delays the request by a random (bounded) time | ||
""" | ||
sleep(random.uniform(0.2, 0.7)) # sleep a random duration to try and evade suspention | ||
|
||
|
||
class CustomLinkedinClient(Linkedin): | ||
|
||
def _fetch(self, uri, evade=my_default_evade, **kwargs): | ||
""" | ||
GET request to Linkedin API | ||
""" | ||
return super()._fetch(uri, evade, **kwargs) | ||
|
||
def _post(self, uri, evade=my_default_evade, **kwargs): | ||
""" | ||
POST request to Linkedin API | ||
""" | ||
return super()._post(uri, evade, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters