From c03ac5e3cec68e75b91ced4de981a7bc68bc9394 Mon Sep 17 00:00:00 2001 From: Luke Faraone Date: Fri, 6 Dec 2013 17:50:55 -0500 Subject: [PATCH] Update style of client strings. (imported from commit 1516461cf53b2715de68e01f16bb8a8cc33c48ad) --- README.md | 2 +- bots/check-mirroring | 2 +- bots/sync-public-streams | 2 +- bots/tddium-notify-humbug | 1 + integrations/asana/zulip_asana_mirror | 2 +- integrations/basecamp/zulip_basecamp_mirror | 2 +- integrations/codebase/zulip_codebase_mirror | 2 +- integrations/git/post-receive | 2 +- integrations/hg/zulip-changegroup.py | 2 +- integrations/nagios/nagios-notify-zulip | 2 +- integrations/perforce/zulip_change-commit.py | 3 ++- integrations/rss/rss-bot | 2 +- integrations/svn/post-commit | 2 +- integrations/trac/zulip_trac.py | 2 +- integrations/twitter/twitter-bot | 2 +- integrations/twitter/twitter-search-bot | 2 +- 16 files changed, 17 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 8e5d625..cc0857b 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ At the top of the file: # Make sure the Zulip API distribution's root directory is in sys.path, then: import zulip - zulip_client = zulip.Client(email="your-bot@example.com") + zulip_client = zulip.Client(email="your-bot@example.com", client="MyTestClient/0.1") When you want to send a message: diff --git a/bots/check-mirroring b/bots/check-mirroring index c1df878..50a4718 100755 --- a/bots/check-mirroring +++ b/bots/check-mirroring @@ -43,7 +43,7 @@ zulip_client = zulip.Client( email=zulip_user, api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", verbose=True, - client="test: Zulip monitoring", + client="ZulipMonitoring/0.1", site=options.site) # Configure logging diff --git a/bots/sync-public-streams b/bots/sync-public-streams index 3663b68..a535e76 100755 --- a/bots/sync-public-streams +++ b/bots/sync-public-streams @@ -10,7 +10,7 @@ import unicodedata sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'api')) import zulip -zulip_client = zulip.Client() +zulip_client = zulip.Client(client="ZulipSyncPublicStreamsBot/0.1") def fetch_public_streams(): public_streams = set() diff --git a/bots/tddium-notify-humbug b/bots/tddium-notify-humbug index 7e69115..6ab221c 100755 --- a/bots/tddium-notify-humbug +++ b/bots/tddium-notify-humbug @@ -49,6 +49,7 @@ sys.path.append(zulip_directory) import zulip client = zulip.Client( + client = "ZulipTddiumNotifier/0.1", email = os.environ['ZULIP_USER'], api_key = os.environ.get('ZULIP_API_KEY')) diff --git a/integrations/asana/zulip_asana_mirror b/integrations/asana/zulip_asana_mirror index c68b985..7d5230b 100644 --- a/integrations/asana/zulip_asana_mirror +++ b/integrations/asana/zulip_asana_mirror @@ -48,7 +48,7 @@ else: logging.basicConfig(level=logging.INFO) client = zulip.Client(email=config.ZULIP_USER, api_key=config.ZULIP_API_KEY, - site=config.ZULIP_SITE, client="asana " + VERSION) + site=config.ZULIP_SITE, client="ZulipAsana/" + VERSION) def fetch_from_asana(path): """ diff --git a/integrations/basecamp/zulip_basecamp_mirror b/integrations/basecamp/zulip_basecamp_mirror index ff7ab0b..c92408c 100755 --- a/integrations/basecamp/zulip_basecamp_mirror +++ b/integrations/basecamp/zulip_basecamp_mirror @@ -48,7 +48,7 @@ client = zulip.Client( email=config.ZULIP_USER, site=config.ZULIP_SITE, api_key=config.ZULIP_API_KEY, - client="basecamp " + VERSION) + client="ZulipBasecamp/" + VERSION) user_agent = "Basecamp To Zulip Mirroring script (support@zulip.com)" htmlParser = HTMLParser() diff --git a/integrations/codebase/zulip_codebase_mirror b/integrations/codebase/zulip_codebase_mirror index 8570983..ecf3e39 100755 --- a/integrations/codebase/zulip_codebase_mirror +++ b/integrations/codebase/zulip_codebase_mirror @@ -51,7 +51,7 @@ client = zulip.Client( email=config.ZULIP_USER, site=config.ZULIP_SITE, api_key=config.ZULIP_API_KEY, - client="codebase " + VERSION) + client="ZulipCodebase/" + VERSION) user_agent = "Codebase To Zulip Mirroring script (support@zulip.com)" # find some form of JSON loader/dumper, with a preference order for speed. diff --git a/integrations/git/post-receive b/integrations/git/post-receive index 7ab76d8..a6ffcc0 100755 --- a/integrations/git/post-receive +++ b/integrations/git/post-receive @@ -46,7 +46,7 @@ client = zulip.Client( email=config.ZULIP_USER, site=config.ZULIP_SITE, api_key=config.ZULIP_API_KEY, - client="git " + VERSION) + client="ZulipGit/" + VERSION) # check_output is backported from subprocess.py in Python 2.7 def check_output(*popenargs, **kwargs): diff --git a/integrations/hg/zulip-changegroup.py b/integrations/hg/zulip-changegroup.py index 32095be..57f4ff7 100755 --- a/integrations/hg/zulip-changegroup.py +++ b/integrations/hg/zulip-changegroup.py @@ -87,7 +87,7 @@ def send_zulip(email, api_key, site, stream, subject, content): """ client = zulip.Client(email=email, api_key=api_key, site=site, - client="mercurial " + VERSION) + client="ZulipMercurial/" + VERSION) message_data = { "type": "stream", diff --git a/integrations/nagios/nagios-notify-zulip b/integrations/nagios/nagios-notify-zulip index 2f4e48a..6145952 100755 --- a/integrations/nagios/nagios-notify-zulip +++ b/integrations/nagios/nagios-notify-zulip @@ -15,7 +15,7 @@ for opt in ('type', 'host', 'service', 'state'): parser.add_option('--' + opt) (opts, args) = parser.parse_args() -client = zulip.Client(config_file=opts.config, client="nagios " + VERSION) +client = zulip.Client(config_file=opts.config, client="ZulipNagios/" + VERSION) msg = dict(type='stream', to=opts.stream) diff --git a/integrations/perforce/zulip_change-commit.py b/integrations/perforce/zulip_change-commit.py index 345dff3..95d0a6c 100755 --- a/integrations/perforce/zulip_change-commit.py +++ b/integrations/perforce/zulip_change-commit.py @@ -52,7 +52,8 @@ import zulip client = zulip.Client( email=config.ZULIP_USER, site=config.ZULIP_SITE, - api_key=config.ZULIP_API_KEY) + api_key=config.ZULIP_API_KEY, + client="ZulipPerforce/" + __version__) try: changelist = int(sys.argv[1]) diff --git a/integrations/rss/rss-bot b/integrations/rss/rss-bot index 9bfdd42..4daf83c 100755 --- a/integrations/rss/rss-bot +++ b/integrations/rss/rss-bot @@ -164,7 +164,7 @@ except IOError: log_error_and_exit("Unable to read feed file at %s." % (opts.feed_file,)) client = zulip.Client(email=opts.email, api_key=opts.api_key, - site=opts.site, client="rss " + VERSION) + site=opts.site, client="ZulipRSS/" + VERSION) first_message = True diff --git a/integrations/svn/post-commit b/integrations/svn/post-commit index 28f3315..dd92f49 100755 --- a/integrations/svn/post-commit +++ b/integrations/svn/post-commit @@ -46,7 +46,7 @@ client = zulip.Client( email=config.ZULIP_USER, site=config.ZULIP_SITE, api_key=config.ZULIP_API_KEY, - client="svn " + VERSION) + client="ZulipSVN/" + VERSION) svn = pysvn.Client() path, rev = sys.argv[1:] diff --git a/integrations/trac/zulip_trac.py b/integrations/trac/zulip_trac.py index 67aad24..155d277 100644 --- a/integrations/trac/zulip_trac.py +++ b/integrations/trac/zulip_trac.py @@ -50,7 +50,7 @@ client = zulip.Client( email=config.ZULIP_USER, site=config.ZULIP_SITE, api_key=config.ZULIP_API_KEY, - client="trac " + VERSION) + client="ZulipTrac/" + VERSION) def markdown_ticket_url(ticket, heading="ticket"): return "[%s #%s](%s/%s)" % (heading, ticket.id, config.TRAC_BASE_TICKET_URL, ticket.id) diff --git a/integrations/twitter/twitter-bot b/integrations/twitter/twitter-bot index 7c89c41..bcf8497 100755 --- a/integrations/twitter/twitter-bot +++ b/integrations/twitter/twitter-bot @@ -129,7 +129,7 @@ client = zulip.Client( email=options.email, api_key=options.api_key, site=options.site, - client="twitter " + VERSION, + client="ZulipTwitter/" + VERSION, verbose=True) if since_id < 0 or options.twitter_id != user_id: diff --git a/integrations/twitter/twitter-search-bot b/integrations/twitter/twitter-search-bot index 404666e..4c860cf 100755 --- a/integrations/twitter/twitter-search-bot +++ b/integrations/twitter/twitter-search-bot @@ -146,7 +146,7 @@ client = zulip.Client( email=opts.email, api_key=opts.api_key, site=opts.site, - client="twitter search " + VERSION, + client="ZulipTwitterSearch/" + VERSION, verbose=True) search_query = " OR ".join(opts.search_terms.split(","))