daniilr / python-lj

LiveJournal API for Python available via PIP (PyPi). Python 3 support included
Other
12 stars 11 forks source link

Library throws an exception talking to dreamwidth.org #12

Open zetasyanthis opened 8 years ago

zetasyanthis commented 8 years ago

Dreamwidth is Live-Journal based and uses the same XML-RPC interface (maybe a slightly older version?). This should work, but blows up with the following error.

Note that oddly, ljdump doesn't blow up talking to dw, so it is possible for this to work, but ljdump is not nearly the fully featured library this is. I'm investigating what it's doing differently...

Updated 68 entries and 2 comments
Downloading journal entries
69 entries to download
getting entries starting at 2015-09-24 23:22:44
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/lj/lj.py", line 326, in _getevents
    response = self.__request('getevents', arguments)
  File "/usr/local/lib/python3.4/dist-packages/lj/lj.py", line 78, in __request
    response = method(args)
  File "/usr/lib/python3.4/xmlrpc/client.py", line 1098, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python3.4/xmlrpc/client.py", line 1437, in __request
    verbose=self.__verbose
  File "/usr/lib/python3.4/xmlrpc/client.py", line 1140, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python3.4/xmlrpc/client.py", line 1156, in single_request
    return self.parse_response(resp)
  File "/usr/lib/python3.4/xmlrpc/client.py", line 1327, in parse_response
    return u.close()
  File "/usr/lib/python3.4/xmlrpc/client.py", line 657, in close
    raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault 406: "Client error: Client is making repeated requests.  Perhaps it's broken?">

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./src/myarchive/main.py", line 161, in <module>
    main()
  File "./src/myarchive/main.py", line 154, in main
    ljapi.download_journals_and_comments(db_session=tag_db.session)
  File "/mnt/bulk/repos/projects/myarchive/src/myarchive/ljlib.py", line 55, in download_journals_and_comments
    nj = update_journal_entries(server=self._server, journal=self.journal)
  File "/usr/local/lib/python3.4/dist-packages/lj/backup.py", line 117, in update_journal_entries
    sync = server.getevents_syncitems(one_second_before(syncitems[0][1]))
  File "/usr/local/lib/python3.4/dist-packages/lj/lj.py", line 362, in getevents_syncitems
    return self._getevents(selecttype="syncitems", lastsync=lastsync, **kwds)
  File "/usr/local/lib/python3.4/dist-packages/lj/lj.py", line 328, in _getevents
    raise LJException(v)
lj.lj.LJException: <Fault 406: "Client error: Client is making repeated requests.  Perhaps it's broken
zetasyanthis commented 8 years ago

Actually, I should note that this is with the small mod from here inserted to let it run at all... That could be layering to cause this issue, but I don't quite understand the protocol well enough to determine if that's the cause. (Apologies if it is.)

zetasyanthis commented 7 years ago

Finally getting back to my own project that uses this and it looks like we've got another issue with dreamwidth.org compatibility.

I'm not quite sure what the right thing to do is here. Looks like the API is kicking out 2015-09-24 23:22:44.000000. Sticking a [:19] to force trim the date string down to just seconds seems to work, but I'm not sure if that's a good solution.

Traceback (most recent call last): File "./main.py", line 238, in main() File "./main.py", line 228, in main db_session=tag_db.session File "/home/zeta/repos/projects/myarchive/src/myarchive/modules/ljlib.py", line 131, in download_journals_and_comments ljapi.download_journals_and_comments(db_session=db_session) File "/home/zeta/repos/projects/myarchive/src/myarchive/modules/ljlib.py", line 60, in download_journals_and_comments nj = update_journal_entries(server=self._server, journal=self.journal) File "/usr/local/lib/python3.5/dist-packages/lj/backup.py", line 117, in update_journal_entries sync = server.getevents_syncitems(one_second_before(syncitems[0][1])) File "/usr/local/lib/python3.5/dist-packages/lj/backup.py", line 65, in one_second_before return str(datetime_from_string(s) - datetime.timedelta(seconds=1)) File "/usr/local/lib/python3.5/dist-packages/lj/backup.py", line 57, in datetime_from_string return datetime.datetime.strptime(s, "%Y-%m-%d %H:%M:%S") File "/usr/lib/python3.5/_strptime.py", line 510, in _strptime_datetime tt, fraction = _strptime(data_string, format) File "/usr/lib/python3.5/_strptime.py", line 346, in _strptime data_string[found.end():]) ValueError: unconverted data remains: .000000