Commit graph

123 commits

Author SHA1 Message Date
Anders Kaseorg 19f5b4f6a6 mypy: Fix exec_module type: ignore comments.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-10 09:58:18 -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
Ganesh Pawar 44b6fd395a tests: Fix tests failing on Windows.
Tests were failing on Windows since paths are case-insensitive on it.
This uses pathlib library to compare paths on all platforms.

Fixes #651
2021-03-04 11:28:35 -08:00
LoopThrough-i-j 1fb3d529a9 zulip-bots: Set bot_handler type to BotHandler.
- Set `bot_handler` type to `BotHandler`.
- Fix mypy issues in improperly typed variables, params and returns.

Fixes part of #639
2021-03-03 13:31:50 -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
Alex Vandiver 385fb51f01 zulip-botserver: Document use of environment var in README.md 2021-01-07 00:31:26 -08:00
LoopThrough-i-j bcf183d2b1 zulip-botserver: Allow passing config via JSON formatted environment variable.
Fixes #485.

Co-authored-by: Alex Vandiver <alexmv@zulip.com>
2021-01-07 00:31:26 -08:00
Eeshan Garg befbb953dd pypi: Release version 0.7.1. 2020-10-09 15:50:43 -02:30
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
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
Eeshan Garg 1dac75f979 pypi: Release version 0.7.0. 2020-04-20 23:23:58 -02:30
Anders Kaseorg 6f40bcf745 cleanup: Fix whitespace around parameter equals.
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 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 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
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
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
neiljp (Neil Pilgrim) 520a004b85 botserver: Raise exceptions rather than returning them. 2020-03-24 21:25:45 -07:00
neiljp (Neil Pilgrim) fca2404b46 mypy: Add type ignore in botserver/server.py. 2020-03-24 21:25:45 -07:00
Eeshan Garg 957b5e7ad8 pypi: Release version 0.6.3. 2019-12-16 11:48:56 -03:30
Eeshan Garg efcc89da9d pypi: Release version 0.6.2. 2019-12-14 16:38:48 -03:30
neiljp (Neil Pilgrim) 0427d962b0 setup.py: Add supported python versions for all packages. 2019-09-03 13:28:32 -07:00
Rohitt Vashishtha 74d902d14f botserver: Allow importing custom bot modules.
We can now specify path to a bot's python file as the ini section
header in the botserver's config file. For example:

[~/Documents/helloworld.py]
email=a@b.com
key=XXXX
site=https://b.com
token=XXXX
2019-09-03 13:27:21 -07:00
Anders Kaseorg c6a52d798e zulip_bots, zulip_botserver: Add PEP 561 type annotation markers.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 17:29:04 -07:00
Eeshan Garg e5bcd095fd pypi: Release version 0.6.1. 2019-07-14 21:17:53 -02:30
Eeshan Garg accfa8ddaf pypi: Release version 0.6.0. 2019-03-19 19:43:23 -02:30
Tim Abbott fae8e4c0b0 botserver: Add a python3 !# line. 2019-03-18 13:10:06 -07:00
Eeshan Garg d43b9328f0 pypi: Release version 0.5.9. 2019-02-17 02:49:27 -03:30
Eeshan Garg 9931de2c6b pypi: Release version 0.5.8. 2019-01-22 22:35:37 -03:30
Eeshan Garg ed6c797d19 pypi: Release version 0.5.7. 2019-01-16 20:50:46 -03:30
Eeshan Garg d478c91965 pypi: Release version 0.5.6. 2018-12-17 17:07:32 -03:30
Eeshan Garg 09deda9466 pypi: Release version 0.5.5. 2018-09-25 22:36:57 -02:30
Eeshan Garg 048fa79a7c pypi: Release version 0.5.4.
Starting now, we now also have a CHANGELOG to record major changes
to the zulip package.
2018-08-31 17:25:55 -02:30
Eeshan Garg 6151f2db40 pypi: Release version 0.5.3. 2018-08-17 22:21:01 -02:30
Rohitt Vashishtha cb183fef4c botserver: Add tests for reading config section by bot name. 2018-07-27 13:43:42 -04:00
Eeshan Garg 1127f973aa pypi: Release version 0.5.2. 2018-07-26 21:19:12 -02:30
novokrest 50173c105b botserver: Read bot's config from config section with bot's name.
This commit changes the default behavior for a hypothetical bot
named 'bot_one' to the following with the config file:

1. Find and load section named 'bot_one', else...
2. Find and load the first section, else...
3. Exit with error message.

Also, we now gracefully show missing options in a config section
instead of printing the whole stacktrace of the exception.
2018-07-12 20:49:10 +05:30
Eeshan Garg c2fdd547f7 PyPI: Release 0.5.1. 2018-07-01 12:05:59 -02:30
Eeshan Garg c636a5ac49 pypi: Release 0.5.0. 2018-06-07 12:05:18 -02:30
Robert Hönig 242bcdbadc botserver: Add specific error message for unedited zuliprcs.
Previously, when a user tried to run the Botserver with a
zuliprc but forgot to set the bot name, they were told to
edit the botserverrc file. However, the recommended approach
is to specify the botname with the -b option. This commit
adds an error message specific for this case. It recognizes
zuliprc files by their section header `api`.
2018-06-04 10:14:17 -07:00
Robert Hönig 3ddc8f9b5d botserver: Make bot-name-not-found error more user-friendly.
Previously, when a bot name wasn't found, the Botserver threw
an ImportError with an error message. This results in an
intimidating traceback which is in most cases not helpful to
the user. This commit replaces the ImportError with sys.exit.
2018-06-04 10:14:17 -07:00
Robert Hönig c85b42be9f botserver: Exit with helpful output if botserverrc is invalid.
If the botserverrc file contains empty section headers, it
is very likely that the user forgot to edit the file. This
reminds them to do so.
2018-06-04 10:14:17 -07:00
Robert Hönig 3d05b88cc2 botserver: Rename zulip-bot-server to zulip-botserver.
This is consistent with the correct prose "Botserver"
(instead of "Bot-server").
2018-06-04 10:14:17 -07:00
Robert Hönig f4e0808a87 botserver: Validate token before accepting message.
Previously, the botserver would accept any message sent
to it. This was a security hazard, since an attacker could
impersonate arbitrary users with arbitrary messages. We only
want the Zulip instance where a bot is registered to be able
to send out messages for that bot. To do this, this commits
adds a check for the security token associated with each
outgoing webhook bot. For each bot, its token is stored in
the botserverrc file. The server sends the token along with
each message.
2018-05-30 09:37:33 -04:00