pumpsearch
Table of Contents
PumpSearch
This python program, built on PyPump, provides very simplistic search capability for your activities on pump.io.
Usage
python ./pumpsearch.py me@someplace.org "Linux"
Code
#!/usr/bin/env python import sys from pypump import PyPump, Client from pypump.models.image import Image from pypump.models.collection import Collection from pypump.models.collection import Public from pypump.models.person import Person from pypump.exception import PyPumpException def simple_verifier(url): print 'Go to: ' + url return raw_input('Verifier: ') # they will get a code back def CreatePumpClient(webfinger, client_credentials,client_tokens): client = Client( webfinger=webfinger, type="native", name="NavierStokes", key=client_credentials[0], secret=client_credentials[1], ) pump = PyPump( client=client, token=client_tokens[0], # the token secret=client_tokens[1], # the token secret verifier_callback=simple_verifier ) return pump client_credentials = [] client_tokens = [] if len(sys.argv) < 3: print "You need to provide your webfinger and a search term in quotes." sys.exit() webfinger = sys.argv[1] search_string = sys.argv[2] pump_client = CreatePumpClient(webfinger, client_credentials, client_tokens) if not pump_client: print "Unable to create client for pump.io" sys.exit() pump_me = pump_client.Person(webfinger) for activity in pump_me.outbox.major[:]: try: message = activity.obj.content except AttributeError: continue if message == None: continue if message.find(search_string) != -1: try: url = activity.obj.url except AttributeError: print activity print activity.obj print activity.obj.original continue print "========================== SEARCH RESULT ===========================" print url print message print "--------------------------------------------------------------------" pass pass
pumpsearch.txt · Last modified: 2014/10/26 10:10 by sekula