Commit graph

480 commits

Author SHA1 Message Date
rht fe2a4d6fe8 [BUGFIX] IRC bridge: Use connection initialized from aio_reactor.
Additionally, pin the irc library version to 18.0 because the newer
version has an error in the AioReactor:
```
  File "/home/rht/code/venv/lib/python3.8/site-packages/irc/bot.py", line 108, in run
    self.bot.reactor.scheduler.execute_after(intvl, self.check)
AttributeError: 'AioReactor' object has no attribute 'scheduler'
```
2020-08-10 17:12:04 -07:00
Kartik Srivastava 36071821c3 api: Update type annotation in 'remove_subscriptions'.
This updates the type annotation for the 'principals' argument
to accept a list of email addresses as well as user ids.
2020-08-10 16:38:39 -07:00
Alex Vandiver 9745ec9ceb doc: Document the backoff class better. 2020-08-10 15:07:01 -07:00
Alex Vandiver 7a7cfe637e zephyr: Mark the infinite loops as NoReturn. 2020-08-10 15:07:01 -07:00
Alex Vandiver a20c9cc6d7 zephyr: Use exponential backoffs in retry loops.
This reduces the number of retries that might spam APIs.

There is some complexity here which is left un-managed -- for
instance, maybe_restart_mirroring_script does a number of restart
attempts, and then fails, but will be retried every 15s by the
surrounding `process_loop`.  Previously, it would merely have looped
forever inside maybe_restart_mirroring_script.

Three loops are intentionally left as infinite `while True` loops,
that merely cap their backoff at the default 90s.  Their callers do
not expect, or have any way to handle more gracefully, a failure of
the expected-infinite-loop in `process_loop` or `zulip_to_zephyr`.
They maintain their previous behavior of retrying forever, albeit more
slowly.
2020-08-10 15:07:01 -07:00
rht 8670cce8e9 Matrix bridge: Change the condition of not_from_zulip_bot. 2020-08-07 08:15:07 -04:00
Kartik Srivastava 20e7f197e3 api: Implement DELETE /realm/emoji/{emoji_name}. 2020-08-03 10:29:38 -07:00
Anders Kaseorg 396ef1d11a Update zulipchat.com emails to zulip.com.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-11 21:06:58 -07:00
Anders Kaseorg 5f81eb3a70 Update zulipchat.com links to zulip.com.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-11 21:06:58 -07:00
Kartik Srivastava 9e9b1efdae api: Implement PATCH /realm/profile_fields/{field_id} endpoint. 2020-05-29 17:18:25 -07:00
Kartik Srivastava e25ebce27b api: Implement PATCH /realm/profile_fields endpoint. 2020-05-29 17:18:25 -07:00
Kartik Srivastava a85ac15d2d api: Implement DELETE /realm/profile_fields/{field_id} endpoint. 2020-05-29 17:18:25 -07:00
Kartik Srivastava 22392779a3 api: Implement POST /realm/profile_fields endpoint. 2020-05-29 17:18:25 -07:00
Kartik Srivastava 30fa7c5d2f api: Implement GET /realm/profile_fields endpoint. 2020-05-29 17:18:25 -07:00
Kartik Srivastava 16737e4ed3 api: Add get_members wrapper for get_users for backwards compatibility. 2020-05-14 11:37:23 -07:00
Kartik Srivastava d2b9976015 api: Rename get_members to get_users. 2020-05-14 11:36:17 -07:00
neiljp (Neil Pilgrim) 540d453237 setup.py: Add Source & Documentation project_urls.
The only existing url points to zulip.org -> zulipchat.com
2020-05-05 09:20:50 -04:00
neiljp (Neil Pilgrim) f2c8295fcb requirements: Remove unnecessary install dependency upon six & typing.
The latest release was fully python 3.5+, making these dependencies
redundant.
2020-05-05 09:20:50 -04:00
Eeshan Garg 1dac75f979 pypi: Release version 0.7.0. 2020-04-20 23:23:58 -02:30
Eeshan Garg 4e0c963127 zulip/README.md: Add note clarifying Python 2 support. 2020-04-18 20:33:17 -07:00
Anders Kaseorg f616b9259e irc_mirror_backend: Remove repeated dictionary key.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 17cf26aa1f cleanup: Move line breaks before binary operators.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg bd9bb0a4e8 cleanup: Fix indentation.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 54b2578204 cleanup: Remove unused variables.
Generated by autoflake.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 2f6623bbc4 cleanup: Remove unused imports.
Generated by autoflake.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 5428c5f296 typing: Convert function type annotations to Python 3 style.
Generated by com2ann (slightly patched to avoid also converting
assignment type annotations, which require Python 3.6), followed by
some manual whitespace adjustment, and two fixes for use-before-define
issues:

-    def set_zulip_client(self, zulipToJabberClient: ZulipToJabberBot) -> None:
+    def set_zulip_client(self, zulipToJabberClient: 'ZulipToJabberBot') -> None:

-def init_from_options(options: Any, client: Optional[str] = None) -> Client:
+def init_from_options(options: Any, client: Optional[str] = None) -> 'Client':

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg fe72f3b131 typing: Remove ‘if False’ guard for typing imports.
typing is in the Python 3.5 standard library.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg ddb05ea7eb add_default_arguments: Correct custom_error_handling type annotation.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 953709fdd5 log2zulip: Adjust for zulip setup_path_on_import → setup_path change.
687553a661

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Kartik Srivastava f9d6c085a1 api: Implement POST /default_streams api endpoint. 2020-04-18 15:05:53 -07:00
akashaviator ef730b2c1b api: Implement GET /messages/matches_narrow endpoint. 2020-04-18 15:05:36 -07:00
Anders Kaseorg d68437d5f5 Rewrite some strings using raw string syntax.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 15:04:36 -07:00
Anders Kaseorg e30b3b094b Modernize legacy Python 2 syntax with pyupgrade.
Generated by `pyupgrade --py3-plus --keep-percent-format` followed by
manual indentation fixes.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 15:04:36 -07:00
Eeshan Garg 543eb396b9 zulip/README: Specify the required Python version.
We recently dropped support for Python versions less than 3.5.
Since the README is also used as the project description on our
PyPI homepage, we need to be more explicit about what version of
Python our bindings require.
2020-04-16 19:35:54 -07:00
Eeshan Garg dd201926fa pypi_packages: Use README files for long descriptions. 2020-04-16 19:35:54 -07:00
Eeshan Garg c55bf78c6b pypi: Specify the correct license classifier for all packages. 2020-04-16 19:35:54 -07:00
Kartik Srivastava 04e43b95bc api: Implement /users/{user_id}/reactivate api endpoint. 2020-04-15 17:18:00 -07:00
akashaviator 59b025d2e4 api: Implement PATCH /users/{user_id} endpoint. 2020-04-09 17:17:59 -07:00
Kartik Srivastava ed706c24ce api: Implement GET /realm/presence endpoint. 2020-04-09 17:17:29 -07:00
Kartik Srivastava 8b0fa6bfee
api: Implement GET /attachments endpoint. 2020-04-07 16:44:49 -07:00
rht f47559e68d bridge_between_zulips: Replace "subject" with "topic" in doc. 2020-04-07 16:20:19 -07:00
rht ceda54b50c bridge_between_zulips: Add explanation of --stream to README.md. 2020-04-07 16:20:19 -07:00
Kartik Srivastava 6dd52439bf
api: Implement DELETE /users/{user_id} api endpoint. 2020-04-07 16:12:59 -07:00
Kartik Srivastava 8d7eb0fea3
api: Refactor get_user_by_id to take keyword arguments.
This refactors get_user_by_id to take arguments like
`include_custom_profile_fields = True` instead of
{include_custom_profile_fields: True}.
2020-04-07 16:12:11 -07:00
rht d7c52c9a74 zulip/zulip/__init__.py: Remove shebang and add version assertion. 2020-04-05 07:28:13 -04:00
rht aee73b32e0 zulip/setup.py: Remove Python 2 from supported versions. 2020-04-03 08:18:08 -04:00
rht 439c096eac Remove all remaining six imports. 2020-04-03 08:18:08 -04:00
rht 565106b880 test_default_arguments: Add explicit python3 shebang. 2020-04-03 08:18:08 -04:00
rht f34540d26d Add explicit python3 shebang to __init__.py. 2020-04-03 08:18:08 -04:00
rht 4600ce59a3 Remove all remaining from __future__ imports. 2020-04-03 08:18:08 -04:00
rht 204871b518 Finish the remaining migration of shebang to python3. 2020-04-03 08:18:08 -04:00
rht 9ee8461b9d bridges: Remove sender field from message data.
For the reason why, see
https://chat.zulip.org/#narrow/stream/127-integrations/topic/bridge.20between.20zulips
2020-04-03 06:19:22 -04:00
rht 46c78ce7b5 integrations: Remove usage of six. 2020-04-02 13:02:28 -04:00
rht 1412403037 integrations: Remove from __future__ imports. 2020-04-02 13:02:28 -04:00
rht a465467388 integrations: Switch to python3. 2020-04-02 13:02:28 -04:00
rht d174e589bf examples/upload-file: Use python3-specific import of StringIO. 2020-04-02 09:56:59 -04:00
rht 87198501dc examples: Remove from __future__ imports. 2020-04-02 09:56:59 -04:00
rht e5144b8503 examples: Switch to python3. 2020-04-02 09:56:59 -04:00
orientor d8157d6b80 bridge_with_irc: Initialize IRC bot after checking Zulip bot.
Confirm whether Zulip bot is subscribed to the required stream
first and then Initialize IRC bot object.
2020-03-30 17:41:14 -04:00
orientor de40005f5e bridge_with_irc: Improve user-friendliness.
Edit error and success messages of zulip-irc bridge to be more
user friendly.
2020-03-30 17:41:14 -04:00
rht b771bacac0 bridge_with_irc: Check if bot is subscribed to stream at startup. 2020-03-27 06:59:29 -04:00
Eeshan Garg ce73dab121 pypi: Release version 0.6.4. 2020-03-26 19:52:46 -02:30
Eeshan Garg 0b930cfe86 pypi: Add support for Python 3.8. 2020-03-26 13:38:08 -07:00
akashaviator 2cf49788fd api: Implement GET users/{id} endpoint. 2020-03-25 17:00:52 -07:00
neiljp (Neil Pilgrim) 60984ab2fa mypy: Add type ignores for mixing of str & bytes in zephyr mirror.
In principle these should be fixed properly, but the zephyr code is
difficult to test except in a production setting and is unlikely to be
heavily developed in future.
2020-03-24 21:25:45 -07:00
neiljp (Neil Pilgrim) 436b619021 integrations: Use universal_newlines in check_output to output as str.
Picked up by mypy; otherwise output is in bytes (at least on python 3).
2020-03-24 21:25:45 -07:00
neiljp (Neil Pilgrim) f81843f189 mypy: Clarify type hints in zulip/integrations/. 2020-03-24 21:25:45 -07:00
rht 8a74f576a3 python: Remove per-file copyright notices.
These notices are redundant and obscure what are often very short
example scripts.
2020-03-23 12:52:52 -07:00
Mateusz Mandera 8fc5b777db api: Fix undefined variable reference from previous commit. 2020-03-14 11:36:34 -07:00
orientor 056963bedd api: Add delay_cap as class variable of CountingBackoff class. 2020-03-05 13:33:50 -08:00
orientor 731eb23c9a bridge_with_irc: Print message on successful connection. 2020-03-02 05:51:54 -05:00
Steve Howell dd37e27b36 docstring: Use user_ids for typing endpoint. 2020-02-23 07:45:33 -05:00
Sutou Kouhei 843b21769a twitter: Add support for phrase.
Twitter supports phrase search by quoting terms such as "Zulip API".

If we use the feature, the current twitter-bot can't detect used
search phrase. We can detect used search phrase with this change.
2020-01-14 15:58:08 -08:00
Eeshan Garg 957b5e7ad8 pypi: Release version 0.6.3. 2019-12-16 11:48:56 -03:30
neiljp (Neil Pilgrim) 0a01ea0412 zulip: Move dependency on distro into zulip package. 2019-12-15 11:06:43 -08:00
Eeshan Garg efcc89da9d pypi: Release version 0.6.2. 2019-12-14 16:38:48 -03:30
Puneeth Chaganti 63bc9b8a4f zulip: Use distro.linux_distribution instead of platform
Python 3.8 removes `platform.linux_distribution` and `distro` is the
recommended replacement to use for this function.
2019-11-01 17:49:49 -07:00
Kreyren 3e155ecf93 rss-bot: Updated link pointing to .zuliprc
I believe that rss-bot is pointing to wrong page on documentation, this MR should fix it.

Signed-off-by: Jacob Hrbek <werifgx@gmail.com>
2019-09-08 16:51:54 -07:00
Anders Kaseorg bcffa76873 Restore dependency on typing package for Python < 3.5.
Apparently we still support Python 2.7 for some reason.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-03 13:29:52 -07:00
neiljp (Neil Pilgrim) 0427d962b0 setup.py: Add supported python versions for all packages. 2019-09-03 13:28:32 -07:00
Anders Kaseorg 804501610b Remove dependency on typing package.
It’s in the standard library in Python ≥ 3.5.  (We could have used
`'typing;python_version<"3.5"'` to continue supporting earlier
versions, but we don’t.)

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 17:29:04 -07:00
Anders Kaseorg 567d6ebc25 Client.get_user_presence: Fix blatantly incorrect type annotation.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-07 16:53:42 -07:00
Eeshan Garg e5bcd095fd pypi: Release version 0.6.1. 2019-07-14 21:17:53 -02:30
Puneeth Chaganti 1231da46bf log2zulip: Remove unnecessary loop and fix incorrect variable name. 2019-07-13 11:09:36 -07:00
neiljp (Neil Pilgrim) c2e5b14034 api: Add UnrecoverableNetworkError Exception & use in do_api_query.
This replaces one case where the base ZulipError was raised, and another
where the original exception was re-raised.

This method, and so all API calls, should now only fail via raising this
Exception or by a non-'success' result in the return value dict; this
should avoid leaking any implementation detail and clarify expectations
in user code.
2019-03-29 14:12:26 -07:00
Eeshan Garg accfa8ddaf pypi: Release version 0.6.0. 2019-03-19 19:43:23 -02:30
Eeshan Garg 3a2e85c2b1 zulip: Fix argument name in add/remove reaction example comment.
The actual argument is supposed to be named `reaction_type`, not
`emoji_type`.
2019-03-02 19:12:44 -03:30
Eeshan Garg d43b9328f0 pypi: Release version 0.5.9. 2019-02-17 02:49:27 -03:30
neiljp (Neil Pilgrim) 47f9b103ab api: Fix add_reaction method to pass reaction_data.
Also correct the example usage text.
2019-02-16 03:29:24 -08:00
rht 6368b63e6c interrealm: Fix the msg formatting with special prefixes.
Tweaked by tabbott to cover all code blocks, not just quote blocks.

See https://chat.zulip.org/#narrow/stream/127-integrations/topic/cross.20realm.20bridge/near/695907
2019-02-15 16:43:36 -08:00
Sivagiri Visakan 26c85bb9ed zulip/examples: Add a script to get complete history of a narrow.
Fixes #476.
2019-01-28 22:49:47 -03:30
rht 4773370cc1 bridge_with_irc: Tell people to subscribe their bots to the stream. 2019-01-23 12:40:47 -08:00
Eeshan Garg 9931de2c6b pypi: Release version 0.5.8. 2019-01-22 22:35:37 -03:30
Eeshan Garg f2eaf80b9e integrations/rss: Pass config_file to zulip.Client.
Fixes #499.
2019-01-22 22:16:20 -03:30
rht 5b7f0c24bb bridge_with_irc: Implement nickserv password. 2019-01-17 14:19:46 -08:00
rht 5b704b7c1c bridge_with_irc: Prefix zulip->irc message with sender full name. 2019-01-17 14:19:46 -08:00
rht 836a51a8bf bridge_with_irc: Only forward stream messages at the specified topic. 2019-01-17 14:19:46 -08:00
rht 8ef0aba74a bridge_with_irc: Add command line arg to specify topic. 2019-01-16 16:27:52 -08:00
rht 8e69598a46 bridge_with_irc: Add a brief documentation. 2019-01-16 16:27:52 -08:00
rht 9efa0feaaf bridge_with_irc: Bump irc requirements version. 2019-01-16 16:27:52 -08:00