Commit graph

115 commits

Author SHA1 Message Date
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
Robert Hönig 64a1306e39 Consistently use Botserver instead of botserver or bot server. 2018-05-29 10:58:37 +02:00
Robert Hönig 762118bbea Rename flaskbotrc to botserverrc. 2018-05-29 10:19:50 +02:00
Robert Hönig 3859bef05f botserver: Make handle_bot logic more concise. 2018-05-29 10:05:32 +02:00
Robert Hönig e6ef34a964 botserver: Strip messages like we do in zulip-run-bot.
Previously, messages weren't stripped at all. This
caused most bots to break and send replies similar to
"I didn't understand your command". Nobody noticed,
because the tests were only validating that replies
were sent, but not the content in them. Thus, this
commit also adds tests to avoid further regressions.
2018-05-29 10:05:19 +02:00
Robert Hönig f1bcf3b9a4 botserver: Remove redundant message check.
Previously, the botserver `handle_bot` routine did two checks
on an incoming message:
* First, it checked if the bot email matches
an email in the flaskbotrc.
* Second, it checked if the bot name that corresponds to an email
has a lib module loaded. However, this must be the case, because
all lib modules for all emails are loaded on initialization. Thus,
this commit removes the second check.
2018-05-29 09:52:14 +02:00
Robert Hönig 5c062cee0d botserver: Verify bot response.
This allows for more realistic testing.
2018-05-28 11:13:56 -07:00
Robert Hönig 4285cef29c assert_bot_server_response: Mock ExternalBotHandler. 2018-05-28 11:13:56 -07:00
Robert Hönig 27938a926b Rename assert_bot_server_response param message to event.
It's an event, not a message.
2018-05-28 11:13:56 -07:00