Fix Pinboard JSON duplicate timestamps error#30
Merged
pirate merged 2 commits intoArchiveBox:masterfrom Jul 1, 2017
bardisty:fix-pinboard-json-timestamps-error
Merged
Fix Pinboard JSON duplicate timestamps error#30pirate merged 2 commits intoArchiveBox:masterfrom bardisty:fix-pinboard-json-timestamps-error
pirate merged 2 commits intoArchiveBox:masterfrom
bardisty:fix-pinboard-json-timestamps-error
Conversation
If the JSON exported by Pinboard contains duplicate timestamps, Python returns a TypeError exception: `TypeError: argument of type 'float' is not iterable` This is because `time.mktime()` returns a floating point number. Encasing `time.mktime()` in `str()` fixes the data type not being iterable. `time.mktime()` has also been encased in `int()` to remove the unnecessary decimal value (`.0`) that gets returned for each time value, and to keep the script consistent with the other export functions.
Member
|
Awesome PR, thanks so much! Would you mind actually also commiting your test file under |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If the JSON exported by Pinboard contains duplicate timestamps, Python
returns a TypeError exception:
TypeError: argument of type 'float' is not iterableThis is because
time.mktime()returns a floating point number.Encasing
time.mktime()instr()fixes the data type not beingiterable.
time.mktime()has also been encased inint()to remove theunnecessary decimal value (
.0) that gets returned for each time value,and to keep the script consistent with the other export functions.
Full Error:
JSON test data:
[{"href":"https:\/\/pushover.net\/","description":"Pushover: Simple Notifications for Android, iOS, and Desktop","extended":"","meta":"1e68511234d9390d10b7772c8ccc4b9e","hash":"bb93374ead8a937b18c7c46e13168a7d","time":"2014-06-14T15:51:42Z","shared":"no","toread":"no","tags":"app android"}, {"href":"http:\/\/www.reddit.com\/r\/Android","description":"r\/android","extended":"","meta":"18a973f09c9cc0608c116967b64e0419","hash":"910293f019c2f4bb1a749fb937ba58e3","time":"2014-06-14T15:51:42Z","shared":"no","toread":"no","tags":"reddit android"}]Output after fix: