Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uk access and json save session bug #2

Closed
ian1roberts opened this issue Mar 2, 2013 · 1 comment
Closed

uk access and json save session bug #2

ian1roberts opened this issue Mar 2, 2013 · 1 comment

Comments

@ian1roberts
Copy link

Firstly, thanks for this tool. I've just got my cloud drive mounted on my fedora system.

I had a couple of issues

  1. (not your concern) pyacd has configs for www.amazon.com and www.amazon.jp, so I had to add www.amazon.co.uk to pyacd.init.py, and set ubid
    ln 100. amazon_domain="www.amazon.co.uk"
    ln 135 "www.amazon.co.uk": "ubid-acbuk",

  2. edit session dictionary object to 'accept_terms' and set username in acd
    ln 81-2 self.session.dict['agreed_with_terms']=True
    self.session.username = self.email

  3. unable to dump session to file as session dictionary is not serializable.
    I commented out ln 83 to allow the cloud drive to mount

Would be interested in knowing if you've got a fix for (3)

Thanks again, Ian

Below is the error from json. Mounting proceeds if caching is commented out (ln 81-82)

Trying to login from cached sessionfile /tmp/acd_fuse/sessionfile
Cached session failed; trying auth login
Traceback (most recent call last):
  File "/home/ian/bin/acd", line 464, in <module>
    fs.main()
  File "/home/ian/bin/acd", line 83, in main
    json.dump(self.session.__dict__, sessfile)
  File "/usr/lib64/python2.7/json/__init__.py", line 181, in dump
    for chunk in iterable:
  File "/usr/lib64/python2.7/json/encoder.py", line 428, in _iterencode
    for chunk in _iterencode_dict(o, _current_indent_level):
  File "/usr/lib64/python2.7/json/encoder.py", line 402, in _iterencode_dict
    for chunk in chunks:
  File "/usr/lib64/python2.7/json/encoder.py", line 436, in _iterencode
    o = _default(o)
  File "/usr/lib64/python2.7/json/encoder.py", line 178, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <pyacd.auth.PicklableCookieJar[Cookie(version=0, 
etc etc etc
]> is not JSON serializable
@ian1roberts
Copy link
Author

Little work around.
I suggest changing json for pickle, this seems to fix the serialization issue.
pyacd must have changed session api. a little.

e.g.

ln 74
            if not self.session.is_logged_in:

The following seems to work with session caching for me

ian@nixbox ~$ acd amazon_cloud
/tmp/acd_fuse/sessionfile
Trying to login from cached sessionfile /tmp/acd_fuse/sessionfile
Login successful; starting filesystem

These were the lines I changed ...

import pickle
ln 68
           with open(self.sessionfile, "rb") as sessfile


ln 70-3
                session.__dict__ = pickle.load(sessfile)
                self.session = pyacd.login(session=session)
                self.session.__dict__['agreed_with_terms']=True
                self.session.username = self.email

ln 81
            with open(self.sessionfile, "wb") as sessfile:
ln 85
                self.session.__dict__['agreed_with_terms']=True
                self.session.username = self.email
                pickle.dump(self.session.__dict__, sessfile)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant