Commit Graph

705 Commits

Author SHA1 Message Date
Aditya Bansal 02b855a389 pep8: Add compliance with rule E261 test-bots. 2017-06-04 15:00:58 +05:30
Aditya Bansal 8d06b5d9d9 pep8: Add compliance with rule E261 bot_lib.py. 2017-06-04 15:00:42 +05:30
Aditya Bansal f0b1a6c8d2 pep8: Add compliance with rule E261 virtual_fs.py. 2017-06-04 14:58:37 +05:30
Abhijeet Kaur f320ff11f7 bots: Add tests for followup bot.
'followup' bot has different message handling behavior for
different messages.
For usual messages it calls 'send_message' function of
'BotHandlerApi' class.
For empty messages it calls 'send_reply' function of
'BotHandlerApi' class.
2017-06-02 17:24:41 -07:00
Abhijeet Kaur 72b877c7de bots: Add mock test for 'send_message' function in 'bots_test_lib' file.
Since few bots directly call 'send_message' function of
'BotHandlerApi' class instead of calling 'send_reply' function
first, add 'mock_test_send_message' to check for 'send_message'
function.

All test_<bot>.py files now need to specify which function the bot
will be sending the response to, for each particular message.

Make 'test_virtual_fs.py' and 'test_thesaurus.py' test files
consistent with other bots.
2017-06-02 17:24:41 -07:00
Rohitt Vashishtha db9918f3d6 bots: Move contrib_bots to api/bots*.
This will make it convenient to include these bots in Zulip API
releases on pypi.

Fix #5009.
2017-06-01 12:31:54 -07:00
Aditya Bansal 9814bd77cc pep8: Add compliance with rule E261 google/google-calendar. 2017-05-31 17:07:15 -07:00
Aditya Bansal cc9e08bf87 pep8: Add compliance with rule E261 to bots/check-mirroring. 2017-05-31 17:07:15 -07:00
Aditya Bansal 3c50019001 pep8: Add compliance with rule E261 to api/integrations/rss/rss-bot. 2017-05-31 17:07:15 -07:00
Aditya Bansal 5b6a21c100 pep8: Add compliance with rule E261 to api/examples/upload-file. 2017-05-31 17:07:15 -07:00
Eeshan Garg fc6125ec2e api/setup.py: Upgrade the version to 0.3.1.
Apparently, PyPI is very strict about package file names. Once you
upload files for 0.3.0, and only wish to make minor changes and
re-release it as the same version, it doesn't let you and complains
about identical file names.
2017-05-30 22:25:14 -07:00
Eeshan Garg ea131936d6 api/setup.py: Upgrade to Beta and update homepage URL. 2017-05-30 22:25:14 -07:00
Eeshan Garg 99c2e1875d api: Increase the version from 0.2.5 to 0.3.0. 2017-05-29 20:09:59 -07:00
Eeshan Garg debe9fa9dc api: If there is no $HOME, assume .zuliprc doesn't exist. 2017-05-29 20:09:57 -07:00
Tim Abbott ce26f0e086 integrations: Remove legacy basecamp integration.
Now that we have the webhook integration, there's no reason to
maintain the pre-webhook version.
2017-05-29 15:10:59 -07:00
Tim Abbott c5bc1265f3 bots: Move log2zulip into api/integrations. 2017-05-26 15:15:56 -07:00
Reid Barton ccb4c5c26f bots: Move zephyr-related files to api/integrations/zephyr/. 2017-05-26 15:07:02 -07:00
Reid Barton 2f21290407 bots: Move IRC and Jabber mirror scripts to api/integrations.
This is part of cleaning out the old bots/ top level directory.
2017-05-26 15:04:55 -07:00
Reid Barton 461856dd56 rss-bot: Add --unwrap, --math options.
These are for processing arXiv API results.
2017-05-25 16:24:07 -07:00
Eeshan Garg 3843f191b4 api: Use the console_scripts entry point to point to zulip-send.
Instead of using the `scripts` keyword, we now use the
`console_scripts` entry point to point to the zulip-send script
to be installed. This is what the Python Packaging User Guide
recommends for better cross-platform compatibility.
2017-05-22 18:08:18 -07:00
Jordan Gedney 36406b6a25 mypy: Add type: ignores for optparse.OptionGroup.
Typeshed has already fixed this upstream (Description is optional)
2017-05-22 14:40:48 -07:00
Jordan Gedney 2c21c26b50 mypy: PySvn Client.Log returns a dictionary mapping to many different types. 2017-05-22 14:39:26 -07:00
Tomasz Kolek 61d5d41067 Add Slack importer bot. 2017-05-09 10:48:08 -07:00
Aditya Bansal b642696e5d pep8: Add compliance with rule E261 to api/zulip/__init__.py. 2017-05-07 23:21:50 -07:00
Aditya Bansal 4ebcbfadd7 pep8: Add compliance with rule E261 to api/setup.py. 2017-05-07 23:21:50 -07:00
Aditya Bansal 1efb2cbc7f pep8: Add compliance with rule E261 to zulip_openshift_config.py. 2017-05-07 23:21:50 -07:00
Eeshan Garg b8f71c5d24 Document how to set up an Asana integration via Zapier.
Fixes #3948.
2017-03-21 19:56:47 -07:00
derAnfaenger 0047dbaa24 Replace native datetimes in the Codebase integration.
Update all utcnow() and now() calls, as well as other native dates to
specify the UTC timezone.
Fixes #3809.
2017-03-08 15:32:06 -08:00
sinwar 6f0564e9f4 python: Fix remaining bare excepts in codebase.
Fixes #2862.
2017-03-05 16:17:04 -08:00
Raghav Jajodia a3a03bd6a5 mypy: Added Dict, List and Set imports.
Fixed mypy errors associated with the upgrade.
2017-03-04 14:33:44 -08:00
Rishi Gupta 28d3af0965 Fix several new errors caught by mypy 0.501.
Clear out a bunch of easy to review errors, so we can focus on the more
complicated ones.
2017-03-03 14:12:52 -08:00
Elliott Jin 2ea0430bf1 Clean up timestamp formatting in Google Calendar bot. 2017-02-28 09:29:07 -08:00
Elliott Jin be57d49beb Google Calendar bot: Populate events array directly. 2017-02-26 18:05:46 -08:00
Elliott Jin 31d777a138 Google Calendar bot: Include time zone offsets in timestamps.
Fixes: #3769
2017-02-26 18:05:46 -08:00
Tim Abbott 32bfebeb7a mypy: Fix inconsistencies in use of *args/**kwargs. 2017-02-18 18:39:44 -08:00
Tim Abbott 473c0ee1fe mypy: Remove now-unused type: ignores. 2017-02-18 17:01:01 -08:00
Tim Abbott ffc24e9f66 api: Add bindings for new get_presence endpoint. 2017-02-10 23:52:56 -08:00
Eklavya Sharma de6884c406 Change True to 'True' in requests.get params.
According to stubs from mypy 0.4.7 onwards, `requests.get` takes
a parameter `params` of type `Dict[AnyStr, AnyStr]` where `AnyStr`
can be either bytes or text.  Actually, requests can accept values
of other types in dicts too but it casts them to a string type.

So to avoid type checking error messages, change `True` to `'True'`.
2017-02-07 12:55:25 -08:00
Rohitt Vashishtha 7a174791f1 api: Add support for Environment Variables.
This adds support for controlling the basic configuration (user, API
key, etc.) of the Zulip API bindings via environment variables.

Fixes #3364.

Tweaked by tabbott to update variable names and document in README.md.
2017-02-06 22:56:59 -08:00
Tim Abbott 36d54cf5ff Replace references to zulip.com/dist with zulip.org/dist.
Now that zulip.org has all the files to distribute, there's no reason
to still point to the soon-to-be-decommissioned zulip.com/dist.
2017-01-28 17:56:25 -08:00
Steve Howell eb69791712 Fix update_message() in our API.
This was regressed in b3df1ddeb1.
2017-01-25 16:33:19 -08:00
Tim Abbott 4e171ce787 lint: Clean up E126 PEP-8 rule. 2017-01-23 22:06:13 -08:00
Tim Abbott d6e38e2a5c lint: Clean up E123 PEP-8 rule. 2017-01-23 21:34:26 -08:00
Tim Abbott 9cc83f87fc lint: Clean up E241 PEP-8 rule. 2017-01-23 21:21:14 -08:00
Tim Abbott e5daec46ec lint: Clean up E306 PEP-8 rule. 2017-01-23 21:05:08 -08:00
Tim Abbott e9158dd520 lint: Clean up E121 PEP-8 rule. 2017-01-23 21:02:39 -08:00
Tim Abbott 22d1aa396b lint: Clean up W503 PEP-8 warning. 2017-01-23 20:50:04 -08:00
Sampriti Panda 196cf4367b urls: Move /messages/render to POST endpoint 2017-01-13 16:11:51 -08:00
Rafid Aslam 85def38418 Change error handling in `get_subscribers()` in Zulip API client.
Fixes #3281.
2017-01-13 07:14:50 -08:00
Rafid Aslam d3ee53bdef Move endpoints to use stream_id instead of stream_name in their URLs
- Change `stream_name` into `stream_id` on some API endpoints that use
`stream_name` in their URLs to prevent confusion of `views` selection.

For example:
If the stream name is "foo/members", the URL would be trigger
"^streams/(?P<stream_name>.*)/members$" and it would be confusing because
we intend to use the endpoint with "^streams/(?P<stream_name>.*)$" regex.

All stream-related endpoints now use stream id instead of stream name,
except for a single endpoint that lets you convert stream names to stream ids.

See https://github.com/zulip/zulip/issues/2930#issuecomment-269576231

- Add `get_stream_id()` method to Zulip API client, and change
`get_subscribers()` method to comply with the new stream API
(replace `stream_name` with `stream_id`).

Fixes #2930.
2017-01-12 15:23:31 -08:00
JefftheBest1 f0afa3e8df Fixed typos with receive 2017-01-12 04:52:44 -08:00
JefftheBest1 effa7523a4 Fixed a typo in zulip_change_commit.py 2017-01-12 04:49:47 -08:00
Yago González b0b9ee20e7 integrations: Add code for OpenShift. 2017-01-11 16:23:11 -08:00
Yago González 25dbe35747 api: Support file uploads to the API.
Now, the `Client.do_api_query()` method supports sending files to the
API.

This has allowed the implementation of a new method,
`Client.upload_file(file)`.  It simply uploads the file set in the
parameter, and returns the API's response (that includes the URI).

Despite the fact that `do_api_query()` supports multiple files as
parameters, `upload_file()` doesn't, because right now the API isn't
capable of managing more than a file in the same request.
2017-01-10 17:46:00 -08:00
Tim Abbott 3f8d4193da lint: Fix % comprehensions being used without a tuple. 2017-01-09 11:45:11 -08:00
AZtheAsian e8dafcd905 mypy: Add annotations to api/integrations/asana/zulip_asana_mirror. 2017-01-05 11:08:21 -08:00
ausDensk 059b124027 mypy: Annotate /api/integrations/rss/rss-bot.
With a few tweaks by tabbott.
2017-01-04 22:42:11 -08:00
Tim Abbott fa3a1de9c7 zulip_codebase_mirror: Move Text/six imports after sys.path changes. 2017-01-03 20:24:03 -08:00
AZtheAsian c155b9162d mypy: Annotate api/integrations/codebase/zulip_codebase_mirror. 2017-01-03 20:23:06 -08:00
Tim Abbott 767f30a7e5 zulip_basecamp_mirror: Move some imports after sys.path updates. 2017-01-03 18:36:12 -08:00
Jackson 98ca518461 mypy: Add annotations to api/integrations/basecamp/zulip_basecamp_mirror 2017-01-03 18:34:26 -08:00
Jackson 0a9869868c Clean PUT /users to POST /users 2017-01-03 15:40:00 -08:00
Jackson 566d55b7c6 mypy: Annotate api/integrations/hg/zulip-changegroup.py 2017-01-03 11:44:43 -08:00
Sampriti Panda 246ac7cadc mypy: Annotate api/integrations/twitter/twitter-search-bot 2017-01-02 08:01:37 -08:00
Jackson 88da3dea7e mypy: Annotate api/integrations/trac/zulip_trac.py 2016-12-30 20:05:14 -08:00
Tommy Ip 29c291b981 mypy: Annotate *api/integrations/perforce/zulip_change-commit.py*. 2016-12-30 15:19:34 -08:00
Vamshi Balanaga bf71ad162c Update Google Calendar Integration.
Update integration to use the latest Google API client.
Move Google Account authorization code to a separate file.
Move relevant files from 'bots/' to 'api/integrations/google/'.
Add documentation for integration.
2016-12-30 12:01:31 -08:00
Tim Abbott 5a51f5f9d5 bots: Move gcal-bot into official API release. 2016-12-30 12:01:31 -08:00
Joshua Pan 0c2d424816 mypy: Get rid of six.moves.configparser and add appropriate classes. 2016-12-30 11:41:17 -08:00
lonerz 3c1c65eaf8 mypy: Annotate api/integrations/twitter/twitter-bot 2016-12-30 11:40:45 -08:00
Tommy Ip 7f187418d4 mypy: Annotate *api/integrations/nagios/nagios-notify-zulip*. 2016-12-28 15:44:47 -08:00
Tommy Ip 3d015eb259 mypy: Annotate *api/integrations/svn/post-commit*. 2016-12-28 08:54:53 -08:00
Tim Abbott ea8e34008d lint: Fix pep-8 rules on recently added files. 2016-12-27 20:16:23 -08:00
Rishi Gupta 6d780d8dc2 mypy: Convert api/ and docs/ to use typing.Text. 2016-12-26 16:11:37 -08:00
Steve Howell efc2d1a675 Simplify, document, and fix the API code.
We used to create endpoints with Client._register.

Now we now have explicit methods for the endpoints.

This allows us to add docstrings and stricter mypy annotations.

This fix also introduces a call_endpoint() method that avoids
the need for manually building urls with API_VERSTRING when you
know the URL pattern of the endpoint you want to hit (and when
the API doesn't have a convenient wrapper).

I fixed a bug with create_users where it now uses PUT instead
of POST.

I also removed client.export(), which was just broken.

I had to change recent-messages and zulip-export, which were
using client.do_api_query and Client._register.

Now it's easier to just call client.call_endpoint() for
situations where our API doesn't have convenient wrappers,
so that's what I did with those scripts.
2016-12-21 11:22:42 -08:00
Tim Abbott e1ed8e61d8 api: remove use of zulip.com domain in API bindings. 2016-12-15 09:35:37 -08:00
Tim Abbott ee3fbe9193 api: Clean up the README.md somewhat. 2016-12-13 22:55:40 -08:00
Tim Abbott 9248edaaeb api: Require a recent version of the typing module. 2016-12-13 22:55:40 -08:00
Tim Abbott 34c3e03ef8 api: Update list of example scripts to include. 2016-12-13 22:55:40 -08:00
Tim Abbott 204ab0a3da api: Update author to Zulip open source project. 2016-12-13 22:55:40 -08:00
Steve Howell 0c49cebe86 Remove deprecated get_messages() API.
This also eliminates a very short script that basically
does nothing but call the long-dead API, so there's not
much to salvage there.
2016-12-13 20:33:20 -08:00
reallyly 94b28e0afb pep8: Fix E128 violations.
With some line-wrapping tweaks by tabbott.
2016-12-13 10:50:14 -08:00
Joy Chen 77938f6247 mypy: Annotate *bots/githook-post-receive* 2016-12-03 15:58:22 -06:00
Joy Chen 97a9fea89d delete check_output backport: Python 2.6 no longer supported 2016-12-03 15:57:20 -06:00
nikolay abc2ff4a06 pep8: Fix many rule E128 violations.
[Tweaked by tabbott to adjust some approaches used in wrapping]
2016-12-03 13:33:31 -08:00
bulat22101 a6f91064a2 pep8: Fix E129 violations 2016-12-03 10:56:36 -08:00
bulat22101 adebc75740 pep8: Fix E502 violations 2016-12-03 10:56:36 -08:00
Juan Verhook 1923045ca6 Annotate api/zulip/__init__.py.
Note that we still can't run mypy against this file and other files,
because of how the interface is dynamically created via _register.  We
will need to change that or use a stub file to make it possible to
annotate this.

This was tweaked by tabbott to fix some bugs.
2016-12-02 18:26:47 -08:00
Sidhant Bhavnani 8c0c12c1d9 pep8: Fix E303 violations. 2016-12-02 15:34:11 -08:00
AZtheAsian 7e14fe65ab pep8: fix E202 violations 2016-12-01 23:06:02 -08:00
AZtheAsian c23f9e0df7 pep8: Fix E111 violations 2016-12-01 14:18:11 -08:00
Rafid Aslam c5316b4002 lint: Fix E127 pep8 violations.
Fix pep8: E127 continuation line over-indented for visual indent
style issue.
2016-12-01 10:23:55 -08:00
Rafid Aslam 41bd88d5ed pep8: Fix E301 pep8 violations.
Fix "E301: expected (1 or 2) blank line" pep8 violations.
2016-11-29 08:51:44 -08:00
Rafid Aslam 7a2282986a pep8: Fix E225 pep8 violations. 2016-11-28 15:21:15 -08:00
Tim Abbott 6b42b12768 twitter-search-bot: Line-wrap very long lines. 2016-11-26 21:24:05 -08:00
Tomasz Kolek b7dfcadf33 Document ZULIP SITE param in twitter bots. 2016-11-26 19:30:45 -08:00
Tomasz Kolek 6d36eb00b6 integrations: Change default ZULIP_SITE to https://zulip.example.com.
Modified:
    asana
    basecamp
    codebase
    git
    jira
    svn
    trac
2016-11-26 19:30:32 -08:00
Tomasz Kolek 2c252de311 Add documentation for changing SITE param in perforce configuration. 2016-11-26 19:24:24 -08:00
Anders Kaseorg 573ec14955 Remove shebang line from non-scripts
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2016-11-26 13:20:22 -08:00
Anders Kaseorg d1dc2cf30e Mark scripts executable
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2016-11-26 13:20:22 -08:00