linkedin-api icon indicating copy to clipboard operation
linkedin-api copied to clipboard

read only error when deploying in Google Cloud Functions

Open jason79 opened this issue 1 year ago • 5 comments

I have some simple code I'm trying out in Google cloud functions using your API. It's telling me "Read-only file system". Can the code be modified to run in Google Cloud Functions?

Traceback (most recent call last): File "/layers/google.python.pip/pip/lib/python3.10/site-packages/flask/app.py", line 2073, in wsgi_app response = self.full_dispatch_request() File "/layers/google.python.pip/pip/lib/python3.10/site-packages/flask/app.py", line 1518, in full_dispatch_request rv = self.handle_user_exception(e) File "/layers/google.python.pip/pip/lib/python3.10/site-packages/flask/app.py", line 1516, in full_dispatch_request rv = self.dispatch_request() File "/layers/google.python.pip/pip/lib/python3.10/site-packages/flask/app.py", line 1502, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args) File "/layers/google.python.pip/pip/lib/python3.10/site-packages/functions_framework/__init__.py", line 99, in view_func return function(request._get_current_object()) File "/workspace/main.py", line 5, in entry api = Linkedin('[email protected]', 'xxxxxx') File "/layers/google.python.pip/pip/lib/python3.10/site-packages/linkedin_api/linkedin.py", line 37, in __init__ self.client.authenticate(username, password) File "/layers/google.python.pip/pip/lib/python3.10/site-packages/linkedin_api/client.py", line 98, in authenticate self._set_session_cookies(self._request_session_cookies()) File "/layers/google.python.pip/pip/lib/python3.10/site-packages/linkedin_api/client.py", line 89, in _set_session_cookies with open(settings.COOKIE_FILE_PATH, "wb") as f: OSError: [Errno 30] Read-only file system: '/layers/google.python.pip/pip/lib/python3.10/site-packages/linkedin_api/.cookie.jr'

jason79 avatar Jul 24 '22 20:07 jason79

Try to set the cookie directory to a location which is readable and writable

tbressers avatar Jul 24 '22 20:07 tbressers

how do you do that? can you show me some code?

jason79 avatar Jul 24 '22 22:07 jason79

I’d start looking for file names with “cookies” in them or related to cookie handling. And then look for code where those cookie functions are used and then apply it in your own code.

Does that work for you?

Rgds Thijs

Op ma 25 jul. 2022 om 00:18 schreef jason79 @.***>

how do you do that? can you show me some code?

— Reply to this email directly, view it on GitHub https://github.com/tomquirk/linkedin-api/issues/245#issuecomment-1193404783, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB5RUVDUPRP7ELARY7YXQ3VVW6NBANCNFSM54QFNNKQ . You are receiving this because you commented.Message ID: @.***>

tbressers avatar Jul 25 '22 06:07 tbressers

I guess i can't do it.... because I can't change the code in the cloud. Google Cloud Functions is pulling the library in through the requirements file. Does that make sense?

jason79 avatar Jul 25 '22 13:07 jason79

Linkedin(linkedin_user, linkedin_pass, cookies_dir='/tmp/cookies')

should do

tangsaidi avatar Jun 01 '23 20:06 tangsaidi