def getUpdateText(self): try: twitter = twython.setup() user_timeline = twitter.getUserTimeline(screen_name="conanobrien") date = user_timeline[0]['created_at'] if self.isToday(timestamp=date): url_linktext = 'Yes' else: url_linktext = 'No' except: url_linktext = 'I have no idea' finally: return url_linktext
def getUpdateText(self): try: twitter = twython.setup(); user_timeline = twitter.getUserTimeline(screen_name="conanobrien"); date = user_timeline[0]['created_at']; if self.isToday(timestamp=date): url_linktext = 'Yes'; else: url_linktext = 'No'; except: url_linktext = 'I have no idea'; finally: return url_linktext
import twython.core as twython import time twitter = twython.setup() def search(emoticon): DB = "" keys =["id","from_user_id","text"] search_results = twitter.searchTwitter(emoticon,rpp="80",lang="en") results = search_results["results"] for result in results: temp = "" for key in keys: try: temp = temp + str(result[key]) + ";;" except UnicodeEncodeError: continue DB = DB + temp + "\n" return DB #smile_icon = [":)",": )",":-)",":D"] #frown_icon = [":(",": (",":-("] # get smile tweets cnt = 0 file1 = open("smileyDB",'a') file2 = open("frownyDB",'a') while True: try:
import twython.core as twython import time twitter = twython.setup() def search(emoticon): DB = "" keys = ["id", "from_user_id", "text"] search_results = twitter.searchTwitter(emoticon, rpp="80", lang="en") results = search_results["results"] for result in results: temp = "" for key in keys: try: temp = temp + str(result[key]) + ";;" except UnicodeEncodeError: continue DB = DB + temp + "\n" return DB #smile_icon = [":)",": )",":-)",":D"] #frown_icon = [":(",": (",":-("] # get smile tweets cnt = 0 file1 = open("smileyDB", 'a') file2 = open("frownyDB", 'a')
import twython.core as twython # Instantiate with Basic (HTTP) Authentication twitter = twython.setup(username="******", password="******") # This returns the rate limit for the requesting IP rateLimit = twitter.getRateLimitStatus() # This returns the rate limit for the requesting authenticated user rateLimit = twitter.getRateLimitStatus(rate_for="user")
SS_API_KEY = config.get("Slideshare", "api_key") SS_SECRET_KEY = config.get("Slideshare", "secret_key") SS_USERNAME = config.get("Slideshare", "username") SS_PASSWORD = config.get("Slideshare", "password") SS_PARAMS = {"api_key": SS_API_KEY, "secret_key": SS_SECRET_KEY, "username": SS_USERNAME, "password": SS_PASSWORD} try: SS_CONN = pyslideshare.pyslideshare(SS_PARAMS, verbose=False) SS_EXISTS = True except: SS_EXISTS = False # Twitter TWITTER_USERNAME = config.get("Twitter", "username") TWITTER_PASSWORD = config.get("Twitter", "password") try: TWITTER_CONN = twython.setup(username=TWITTER_USERNAME, password=TWITTER_PASSWORD) TWITTER_EXISTS = True except: TWITTER_EXISTS = False # Zendesk ZD_USERNAME = config.get("Zendesk", "username") ZD_PASSWORD = config.get("Zendesk", "password") ZD_FORUMS_URL = "http://cloudera.zendesk.com/forums.json" ZD_ENTRIES_URL = "http://cloudera.zendesk.com/forums/%(id)s/entries.json?page=%(page)s" ZD_ENTRY_URL = "http://cloudera.zendesk.com/entries/%(id)s" # JIRA JIRA_USERNAME = config.get("JIRA", "username") JIRA_PASSWORD = config.get("JIRA", "password") JIRA_WSDL = "http://issues.cloudera.org/rpc/soap/jirasoapservice-v2?wsdl"
SS_PASSWORD = config.get('Slideshare', 'password') SS_PARAMS = {'api_key': SS_API_KEY, 'secret_key': SS_SECRET_KEY, 'username': SS_USERNAME, 'password': SS_PASSWORD} try: SS_CONN = pyslideshare.pyslideshare(SS_PARAMS, verbose=False) SS_EXISTS = True except: SS_EXISTS = False # Twitter TWITTER_USERNAME = config.get('Twitter', 'username') TWITTER_PASSWORD = config.get('Twitter', 'password') try: TWITTER_CONN = twython.setup(username=TWITTER_USERNAME, password=TWITTER_PASSWORD) TWITTER_EXISTS = True except: TWITTER_EXISTS = False # Zendesk ZD_USERNAME = config.get('Zendesk', 'username') ZD_PASSWORD = config.get('Zendesk', 'password') ZD_FORUMS_URL = 'http://cloudera.zendesk.com/forums.json' ZD_ENTRIES_URL = 'http://cloudera.zendesk.com/forums/%(id)s/entries.json?page=%(page)s' ZD_ENTRY_URL = 'http://cloudera.zendesk.com/entries/%(id)s' # JIRA JIRA_USERNAME = config.get('JIRA', 'username') JIRA_PASSWORD = config.get('JIRA', 'password') JIRA_WSDL = 'http://issues.cloudera.org/rpc/soap/jirasoapservice-v2?wsdl'