Commit graph

1137 commits

Author SHA1 Message Date
Yago González cb6ae09bc8 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 a792ecd025 contrib_bots: Fix lint error in rate limiting code. 2017-01-10 15:10:17 -08:00
Robert Hönig 26fa2a5fc5 Add a rate limit for bots in contrib_bots
To prevent bots from accidently entering an infinite message loop,
where they send messages as a reacting to their own messages,
this commit adds the RateLimit class to run.py. It specifies how
many messages can be sent in a given time interval. If this rate
is exceeded, run.py exits with an error.
Fixes #3210.
2017-01-10 13:42:40 -08:00
Uma 775df0f30a Improved 'readme.md' file in contrib_bots/lib 2017-01-10 07:03:57 -08:00
Tim Abbott 58a5de0377 lint: Fix % comprehensions being used without a tuple. 2017-01-09 11:45:11 -08:00
Tommy Ip d5690c80c9 bots: Fix bare except clause. 2017-01-09 00:39:33 +00:00
Tommy Ip 3cea2b5f1c contrib_bots: Fix bare except clause. 2017-01-08 16:25:22 -08:00
Tommy Ip 6302f0d645 bots: Fix bare except clause. 2017-01-08 16:25:22 -08:00
Tommy Ip 39d7db40b3 bots: Fix bare except clause. 2017-01-08 16:25:22 -08:00
Tim Abbott 35149e83de contrib_bots: Wrap CommuteBot docs. 2017-01-05 14:58:06 -08:00
andrewallen00 3574017297 interactive bots: Create yoda translator bot 2017-01-05 11:24:24 -08:00
AZtheAsian 082fbf631f mypy: Add annotations to api/integrations/asana/zulip_asana_mirror. 2017-01-05 11:08:21 -08:00
ausDensk 8d603a4489 mypy: Annotate /api/integrations/rss/rss-bot.
With a few tweaks by tabbott.
2017-01-04 22:42:11 -08:00
Tim Abbott bb5abd971a zulip_codebase_mirror: Move Text/six imports after sys.path changes. 2017-01-03 20:24:03 -08:00
AZtheAsian 9efe608203 mypy: Annotate api/integrations/codebase/zulip_codebase_mirror. 2017-01-03 20:23:06 -08:00
Tim Abbott ce94c09da7 zulip_basecamp_mirror: Move some imports after sys.path updates. 2017-01-03 18:36:12 -08:00
Jackson 777fca09d3 mypy: Add annotations to api/integrations/basecamp/zulip_basecamp_mirror 2017-01-03 18:34:26 -08:00
Jackson 630ee0be92 Clean PUT /users to POST /users 2017-01-03 15:40:00 -08:00
Jackson 3504396179 mypy: Annotate api/integrations/hg/zulip-changegroup.py 2017-01-03 11:44:43 -08:00
Sampriti Panda 1010927188 mypy: Annotate api/integrations/twitter/twitter-search-bot 2017-01-02 08:01:37 -08:00
Jackson 3f8f4dc616 mypy: Annotate api/integrations/trac/zulip_trac.py 2016-12-30 20:05:14 -08:00
Tommy Ip 7f123585a2 mypy: Annotate *api/integrations/perforce/zulip_change-commit.py*. 2016-12-30 15:19:34 -08:00
Vamshi Balanaga 88bdcd61b8 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 b352dc85f0 bots: Move gcal-bot into official API release. 2016-12-30 12:01:31 -08:00
Joshua Pan f9104fb7e4 mypy: Get rid of six.moves.configparser and add appropriate classes. 2016-12-30 11:41:17 -08:00
lonerz 6b52b51db6 mypy: Annotate api/integrations/twitter/twitter-bot 2016-12-30 11:40:45 -08:00
Robert Hönig a86066c386 interactive bots: Create converter bot. 2016-12-29 19:28:35 +01:00
Yago González f563654377 interactive bots: Use dev API when in a dev setup.
Now the development API (which is inside the repo, api/) is used when the envionment is a development one.

Credits to Steve Howell (@showell) for the instructions on how to fix this.
2016-12-28 19:25:56 -08:00
Tommy Ip 04f7fe14fa mypy: Annotate *api/integrations/nagios/nagios-notify-zulip*. 2016-12-28 15:44:47 -08:00
Tommy Ip cb98dd411e mypy: Annotate *api/integrations/svn/post-commit*. 2016-12-28 08:54:53 -08:00
Tim Abbott adc678a3ab bots: Fix jabber_mirror_backend annotations.
mypy was super confused because the name "zulip" was both an import
and a global variable in the file.
2016-12-27 21:39:32 -08:00
Tim Abbott 8148b580ca lint: Fix pep-8 rules on recently added files. 2016-12-27 20:16:23 -08:00
Rafid Aslam db39b52d3f interactive bots: Create xkcd bot. 2016-12-27 22:52:51 +01:00
Vamshi Balanaga 2a8c57d77a Modify GitHub Issue bot to use new authentication module. 2016-12-27 11:58:36 -08:00
Vamshi Balanaga da256ef854 Modify GitHub comment bot to use new authentication module, and edit documentation accordingly. 2016-12-27 11:58:36 -08:00
Vamshi Balanaga 69b324229c Create GitHub authentication module. 2016-12-27 11:58:36 -08:00
Rishi Gupta eb983e0bbc mypy: Convert api/ and docs/ to use typing.Text. 2016-12-26 16:11:37 -08:00
Rafid Aslam 5d05703482 interactive bots: Create Giphy bot 2016-12-26 09:38:50 -08:00
Rafid Aslam 8d35f25fd6 contrib_bots: Expose some information about user profile
- Expose some information about user profile in `RestrictedClient`
class, like `full_name` and `email` of the user.

- Add `client` argument to `triage_message()`, now it's possible to
call bot with another method instead of calling the specified
keyword.
2016-12-26 09:38:50 -08:00
Abhay Kashyap 6df2450b60 Created DefineBot and document and added them 2016-12-26 09:07:10 -08:00
Tommy Ip 5ef742638e interactive bots: Create Howdoi bot.
This bot allows users to search technical questions from Stack
Overflow.
2016-12-24 08:22:44 -08:00
Jackson a654ba51e1 interactive bots: Create CommuteBot. 2016-12-21 18:46:59 -08:00
Steve Howell 5ad39e3971 Remove mypy exemption for api/zulip/__init__.py.
This required instead exempting these files:

    bots/jabber_mirror_backend.py
    tools/deprecated/iframe-bot/show-last-messages

Turning on mypy for the API exposes issues in the annotations
of other files.
2016-12-21 11:22:42 -08:00
Steve Howell 14ee40bf52 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
= 1b58c13d91 Interactive bots: Create Github Issues bot. 2016-12-19 21:57:21 -08:00
andrewallen00 e2ed990746 interactive bots: Create comment on issue GitHub bot.
interactive bots: Create comment on issue GitHub bot.

interactive bots: Create comment on issue GitHub bot.

interactive bots: Create comment on issue GitHub bot.

interactive bots: Create comment on issue GitHub bot.
2016-12-17 16:33:08 -08:00
Tim Abbott 42eaabf203 bots: Remove obsolete tddium-notify-humbug. 2016-12-15 12:16:26 -08:00
Tim Abbott ca12fd8009 bots: Remove old zulip.com configuration files. 2016-12-15 09:39:32 -08:00
Tim Abbott b7f29327b6 api: remove use of zulip.com domain in API bindings. 2016-12-15 09:35:37 -08:00
Rafid Aslam 746d9d2b6b contrib_bots: Allow to import code from subdirectory of lib
Allow to import code from subdirectory of `contrib_bots/lib`.
Because sometimes bot requires grouping in their directory,
especially for the bot that has configuartion file and documentation.
2016-12-14 16:35:49 -08:00