Commit graph

475 commits

Author SHA1 Message Date
Anders Kaseorg 626359596e Replace typing.Text with str.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-08-24 20:07:35 -07:00
Anders Kaseorg cb00a29311 test_matrix: Run Python subprocess via sys.executable.
This works better with pytest on Windows.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-08-24 16:51:23 -07:00
Anders Kaseorg 53e59c8c09 Rename default branch to ‘main’
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-08-24 12:50:52 -07:00
rht c602121171 slack bridge: Update doc for current version of making Slack bot user. 2021-07-06 16:21:41 -07:00
PIG208 df60a1ac03 matrix: Fix test failure brought by the hint for usernames change.
Fixes a188a4e72a.
2021-06-28 11:35:54 -02:30
Tim Abbott a188a4e72a matrix: Better hint the format for Matrix usernames. 2021-06-17 14:04:38 -07:00
PIG208 9ce7c52a10 pyupgrade: Reformat with --py36-plus.
This includes mainly fixes of string literals using f-strings or
.format(...), as well as unpacking of list comprehensions.
2021-06-02 18:45:57 -07:00
PIG208 e27ac0ddbe pyupgrade: Replace Text with str.
We uses `pyupgrade --py3-plus` to automatically replace all occurence
of `Text`. But manual fix is required to remove the unused imports. Note
that with this configuration pyupgrade also convert string literals to
.format(...) style, which is manually not included in the commit as well.
2021-06-02 18:45:57 -07:00
PIG208 6f3f9bf7e4 black: Reformat without skipping string normalization. 2021-06-02 18:45:57 -07:00
PIG208 fba21bb00d black: Reformat skipping string normalization. 2021-06-02 18:45:57 -07:00
PIG208 5580c68ae5 isort: Reformat using isort. 2021-06-02 18:45:57 -07:00
rht 5f21952b77 Add click as req in setup.py for zulip-cli. 2021-05-27 23:51:32 -07:00
rht 06bbfd752e Initialize CLI interface for python-zulip-api. 2021-05-24 14:35:02 -07:00
rht 05eaaff802 slack-bridge: Order imports properly. 2021-05-24 14:17:38 -07:00
rht 5b2da94ba5 slack-bridge: Use threading instead of multiprocessing.
This will fix the bug reported in
https://chat.zulip.org/#narrow/stream/127-integrations/topic/bridge_with_slack/near/1182555,
which is specific to macOS.

The error message is
```
AttributeError: Can't pickle local object 'SlackBridge.zulip_to_slack.<locals>._zulip_to_slack'
```
2021-05-24 14:17:38 -07:00
rht 2d9cf64db8 slack-bridge: Use slack_sdk instead of the deprecated slackclient. 2021-05-24 14:17:38 -07:00
Eeshan Garg 63fefd2a0f pypi: Release version 0.8.0. 2021-05-19 22:44:45 -02:30
Abhijeet Prasad Bodas 4d482e0ef3 zulip: Replace GET realm/filters with realm/linkifiers.
In zulip/zulip@3947b0c80a, we replaced
the legacy endpoint to use the term "linkifier" instead of
"filter" and to return the data in a dictionary format.

None of the official clients currently actually use this
endpoint.
2021-04-27 11:06:17 -07:00
LoopThrough-i-j 3c3c361f50 zulip: Fix call_on_each_event.
Fix Improper assignement of narrow variable outside its scope.
2021-04-26 14:14:14 -07:00
Anders Kaseorg 83d4a0c217 sync-public-streams: Rewrite using an event queue.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-06 23:36:35 -07:00
Anders Kaseorg 15c46dce46 sync-public-streams: Fix for Python 3.
bytes are not JSON serializable.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-06 23:36:35 -07:00
Tim Abbott 4627b07396 zephyr: Decrease update frequency of sync-public-streams. 2021-04-06 15:15:42 -07:00
LoopThrough-i-j 70f457f82a zulip: Add support for additional args for Client.call_on_each_*.
- Added `**kwargs` typed `object` in the definition of
  `Client.call_on_each_*` .

- Replaced `**kwargs` type from `Any` to `object` in the
  definition of `Client.register`.

Fixes part of #647
2021-03-24 15:00:44 -07:00
rht 61abb4f59c Add list_subscriptions() back for backward compatibility. 2021-03-11 00:00:56 -08:00
rht 57e8886dfe API: Rename list_subscriptions to get_subscriptions. 2021-03-11 00:00:56 -08:00
Anders Kaseorg 503e8ed82d zephyr: Attempt to fix types.
The mirror has some chance of running on Python 3 now, once the
python-zephyr patch is rebased on 0.2.1, though it’s untested.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-10 23:59:15 -08:00
Anders Kaseorg 34012a4015 mypy: Add stubs for zephyr.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-10 23:59:15 -08:00
Anders Kaseorg 717a549f4b mypy: Prohibit unreachable code.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-04 15:17:09 -08:00
Anders Kaseorg 30f241a126 mypy: Remove unused type: ignore comments.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-04 15:09:58 -08:00
Anders Kaseorg 5b5fda2354 Fix % formatting without a tuple.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-04 15:04:38 -08:00
LoopThrough-i-j 3887ad102e python-zulip-api: Drop python3.5 support.
Fixes Part of #655
2021-02-26 07:32:47 -08:00
LoopThrough-i-j 3e28506607 zulip-apis: Update reaction_data type.
Update `reaction_data` type in add_reaction and
remove_reaction, from Dict[str, str] to Dict[str, Any]
2021-02-23 08:58:23 -08:00
Unam LN 984d9151d5
bots: Fix RSS bot for Python 3.x support.
- Call `super()` in the init method.
- Change return hashlib.md5 syntax to encode properly for Python 3

Signed-off-by: Manu LN <manu+github@lacavernedemanu.fr>
2020-12-22 16:34:32 -08:00
Tim Abbott 59a0a912a8 process_ccache: Update path to Zulip supervisord files. 2020-12-20 11:46:24 -08:00
Steve Howell f100ab07aa jabber mirror: Remove code for occupy/vacate events.
The server no longer sends occupy/vacate events
for streams.

The mirror should continue to work fine by processing
subsription-related events.
2020-10-20 11:21:44 -07:00
Eeshan Garg befbb953dd pypi: Release version 0.7.1. 2020-10-09 15:50:43 -02:30
Thomas Michelat 3630208389
api: Add binding for moving topics between streams.
Adds the method move_topic to the class Client that allows moving
topics between streams.

- The topic can be renamed if the new_topic argument is given
- Partial topic can be moved givent the proper message_id and
  propagate_mode arguments.
- notification to old/new stream can be silenced (active by default)
2020-09-14 15:13:10 -07:00
Kartik Srivastava 1df19c0665 api: update_user_group_members should have a user_group_id parameter.
This avoids weirdly passing an extra field in the request, and also
makes the bindings better align with the API.
2020-08-27 12:55:21 -07:00
Preet Mishra 9a4abb9f87 zulip: Add hash_util_decode() to decode server encoded URL excerpts.
This adds hash_util_decode() to decode a hash_util_encode() [present in
zulip/zulip's zerver/lib/url_encoding.py [1]] encoded string.

The intent is to facilitate code sharing among various python clients
(primarily, Zulip Terminal).

The string replacement before the `unquote` is to recoup for the custom
string replacements in zulip/zulip's zerver/lib/url_encoding.py [1].

Test added.

[1] See hash_util_encode() in https://github.com/zulip/zulip/blob/master/zerver/lib/url_encoding.py.
2020-08-25 16:08:32 -07:00
rht e992f14522 slack-bridge: Use WebClient to post message in Slack. 2020-08-25 15:55:25 -07:00
rht 47a4f258d7 slack-bridge: Update processing of members list according to new API. 2020-08-25 15:55:25 -07:00
rht 89d0dd56b9 slack-bridge: Fall back to real_name when display_name is empty.
This will intentionally raise exception when a real_name field of a user
is empty.
2020-08-25 15:55:25 -07:00
rht 02867979ee bridge: Initialize bridge_with_slack. 2020-08-25 15:55:25 -07:00
Kartik Srivastava 0e98533186 api: Implement GET /users/{user_id}/subscriptions/{stream_id} endpoint. 2020-08-14 16:22:12 -07:00
rht f529bc0d01 IRC bridge: Add documentation on nick password. 2020-08-10 17:12:04 -07:00
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