Changeset 17aa9a2 for python/implugin.py


Ignore:
Timestamp:
2015-05-14T14:29:33Z (9 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Children:
2d88cac4
Parents:
b20014b
Message:

Minor cleanup before I try splitting implugin and the test NewsBlur client.

Still no clue why r.json()[xxx] was throwing exceptoins last week...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/implugin.py

    rb20014b r17aa9a2  
    144144
    145145                # Throw all unread-post hashes in a long list and sort it by posting time.
    146                 #feed_hashes = r.json()["unread_feed_story_hashes"]
    147                 wtf = r.json()
    148                 feed_hashes = wtf["unread_feed_story_hashes"]
     146                feed_hashes = r.json()["unread_feed_story_hashes"]
    149147                all_hashes = []
    150148                for feed, hashes in feed_hashes.iteritems():
     
    160158                if not req_hashes:
    161159                        return
    162                 print req_hashes
    163160               
    164161                # Grab post details.
     
    168165                        return
    169166               
    170                 # Response is not in the order we requested. :-(
    171                 wtf = r.json()
    172                 stories = {}
    173                 for s in wtf["stories"]:
    174                         stories[s["story_hash"]] = s
    175                
     167                # Response is not in the order we requested. :-( Make it a hash
     168                # and reconstruct order from our request.
     169                stories = {s["story_hash"]: s for s in r.json()["stories"]}
    176170                for s in (stories[hash] for hash in req_hashes):
    177171                        line = "%(story_title)s <%(story_permalink)s>" % s
     
    179173                        self.bee.buddy_msg("rss", line, 0, ts)
    180174                        self.seen_hashes.add(s["story_hash"])
    181                         print s["story_hash"]
    182175
    183176
Note: See TracChangeset for help on using the changeset viewer.