mirror of https://github.com/zulip/zulip.git
mypy: Annotate api/integrations/twitter/twitter-search-bot
This commit is contained in:
parent
a5e45f4213
commit
246ac7cadc
|
@ -27,13 +27,14 @@ from __future__ import print_function
|
|||
import os
|
||||
import sys
|
||||
import optparse
|
||||
import six.moves.configparser
|
||||
from six.moves.configparser import ConfigParser, NoSectionError, NoOptionError
|
||||
|
||||
import zulip
|
||||
VERSION = "0.9"
|
||||
CONFIGFILE = os.path.expanduser("~/.zulip_twitterrc")
|
||||
|
||||
def write_config(config, since_id):
|
||||
# type: (ConfigParser, int) -> None
|
||||
if 'search' not in config.sections():
|
||||
config.add_section('search')
|
||||
config.set('search', 'since_id', since_id)
|
||||
|
@ -111,14 +112,14 @@ if not opts.search_terms:
|
|||
parser.error('You must specify a search term.')
|
||||
|
||||
try:
|
||||
config = six.moves.configparser.ConfigParser()
|
||||
config = ConfigParser()
|
||||
config.read(CONFIGFILE)
|
||||
|
||||
consumer_key = config.get('twitter', 'consumer_key')
|
||||
consumer_secret = config.get('twitter', 'consumer_secret')
|
||||
access_token_key = config.get('twitter', 'access_token_key')
|
||||
access_token_secret = config.get('twitter', 'access_token_secret')
|
||||
except (six.moves.configparser.NoSectionError, six.moves.configparser.NoOptionError):
|
||||
except (NoSectionError, NoOptionError):
|
||||
parser.error("Please provide a ~/.zulip_twitterrc")
|
||||
|
||||
if not (consumer_key and consumer_secret and access_token_key and access_token_secret):
|
||||
|
@ -126,7 +127,7 @@ if not (consumer_key and consumer_secret and access_token_key and access_token_s
|
|||
|
||||
try:
|
||||
since_id = config.getint('search', 'since_id')
|
||||
except (six.moves.configparser.NoOptionError, six.moves.configparser.NoSectionError):
|
||||
except (NoOptionError, NoSectionError):
|
||||
since_id = 0
|
||||
|
||||
try:
|
||||
|
|
|
@ -30,7 +30,6 @@ api/integrations/basecamp/zulip_basecamp_mirror
|
|||
api/integrations/codebase/zulip_codebase_mirror
|
||||
api/integrations/git/post-receive
|
||||
api/integrations/rss/rss-bot
|
||||
api/integrations/twitter/twitter-search-bot
|
||||
tools/deprecated/iframe-bot/show-last-messages
|
||||
tools/deprecated/inject-messages/inject-messages
|
||||
zproject/settings.py
|
||||
|
|
Loading…
Reference in New Issue