iembot 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- iembot-0.3.0/.deepsource.toml +15 -0
- iembot-0.3.0/.github/dependabot.yml +15 -0
- iembot-0.3.0/.github/workflows/build.yml +66 -0
- iembot-0.3.0/.github/workflows/codeql.yml +41 -0
- iembot-0.3.0/.github/workflows/etchosts.txt +34 -0
- iembot-0.3.0/.gitignore +18 -0
- iembot-0.3.0/.pre-commit-config.yaml +14 -0
- iembot-0.3.0/CHANGELOG.md +16 -0
- iembot-0.3.0/LICENSE +20 -0
- iembot-0.3.0/MANIFEST.in +2 -0
- iembot-0.3.0/PKG-INFO +62 -0
- iembot-0.3.0/README.md +26 -0
- iembot-0.3.0/conda_requirements.txt +12 -0
- iembot-0.3.0/conftest.py +27 -0
- iembot-0.3.0/environment.yml +20 -0
- iembot-0.3.0/pip_requirements.txt +4 -0
- iembot-0.3.0/pyproject.toml +120 -0
- iembot-0.3.0/run.sh +18 -0
- iembot-0.3.0/scripts/remove_twuser_oauth.py +32 -0
- iembot-0.3.0/settings_example.json +20 -0
- iembot-0.3.0/setup.cfg +4 -0
- iembot-0.3.0/src/iembot/__init__.py +27 -0
- iembot-0.3.0/src/iembot/atmosphere.py +155 -0
- iembot-0.3.0/src/iembot/bot.py +757 -0
- iembot-0.3.0/src/iembot/data/startrek +820 -0
- iembot-0.3.0/src/iembot/main.py +259 -0
- iembot-0.3.0/src/iembot/mastodon.py +244 -0
- iembot-0.3.0/src/iembot/msghandlers.py +169 -0
- iembot-0.3.0/src/iembot/slack.py +283 -0
- iembot-0.3.0/src/iembot/twitter.py +357 -0
- iembot-0.3.0/src/iembot/types.py +46 -0
- iembot-0.3.0/src/iembot/util.py +444 -0
- iembot-0.3.0/src/iembot/webhooks.py +61 -0
- iembot-0.3.0/src/iembot/webservices.py +232 -0
- iembot-0.3.0/src/iembot/xmpp.py +17 -0
- iembot-0.3.0/src/iembot.egg-info/PKG-INFO +62 -0
- iembot-0.3.0/src/iembot.egg-info/SOURCES.txt +50 -0
- iembot-0.3.0/src/iembot.egg-info/dependency_links.txt +1 -0
- iembot-0.3.0/src/iembot.egg-info/entry_points.txt +2 -0
- iembot-0.3.0/src/iembot.egg-info/requires.txt +20 -0
- iembot-0.3.0/src/iembot.egg-info/top_level.txt +1 -0
- iembot-0.3.0/tests/test_atmosphere.py +64 -0
- iembot-0.3.0/tests/test_bot.py +30 -0
- iembot-0.3.0/tests/test_init.py +11 -0
- iembot-0.3.0/tests/test_main.py +124 -0
- iembot-0.3.0/tests/test_mastodon.py +122 -0
- iembot-0.3.0/tests/test_slack.py +83 -0
- iembot-0.3.0/tests/test_twitter.py +175 -0
- iembot-0.3.0/tests/test_util.py +102 -0
- iembot-0.3.0/tests/test_util_channels.py +26 -0
- iembot-0.3.0/tests/test_webservices.py +15 -0
- iembot-0.3.0/tests/test_xmpp.py +14 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# See https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/keeping-your-actions-up-to-date-with-dependabot
|
|
2
|
+
|
|
3
|
+
version: 2
|
|
4
|
+
updates:
|
|
5
|
+
|
|
6
|
+
- package-ecosystem: "github-actions"
|
|
7
|
+
directory: "/"
|
|
8
|
+
schedule:
|
|
9
|
+
interval: "monthly"
|
|
10
|
+
labels:
|
|
11
|
+
- "Bot"
|
|
12
|
+
groups:
|
|
13
|
+
github-actions:
|
|
14
|
+
patterns:
|
|
15
|
+
- '*'
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
name: Install and Test
|
|
2
|
+
on:
|
|
3
|
+
pull_request:
|
|
4
|
+
branches: [ main ]
|
|
5
|
+
push:
|
|
6
|
+
branches: [ main ]
|
|
7
|
+
jobs:
|
|
8
|
+
build-linux:
|
|
9
|
+
defaults:
|
|
10
|
+
run:
|
|
11
|
+
# Ensures environment gets sourced right
|
|
12
|
+
shell: bash -l {0}
|
|
13
|
+
name: Python (${{ matrix.PYTHON_VERSION }})
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
PYTHON_VERSION: ["3.10", "3.13", "3.14"]
|
|
18
|
+
env:
|
|
19
|
+
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v6
|
|
22
|
+
|
|
23
|
+
- name: Run IEM Database container
|
|
24
|
+
run: |
|
|
25
|
+
docker run -d --name iem_database -p 5432:5432 ghcr.io/akrherz/iem_database:test_data
|
|
26
|
+
until docker exec iem_database pg_isready -h localhost; do
|
|
27
|
+
sleep 6
|
|
28
|
+
done
|
|
29
|
+
|
|
30
|
+
- name: Run Memcached container
|
|
31
|
+
run: |
|
|
32
|
+
docker run -d --name iem_memcached -p 11211:11211 memcached:1.6.9
|
|
33
|
+
|
|
34
|
+
- name: Add /etc/hosts entries
|
|
35
|
+
run: |
|
|
36
|
+
cat .github/workflows/etchosts.txt | sudo tee -a /etc/hosts
|
|
37
|
+
|
|
38
|
+
# setup conda-forge with micromamba
|
|
39
|
+
- name: Setup Python
|
|
40
|
+
uses: mamba-org/setup-micromamba@v2
|
|
41
|
+
with:
|
|
42
|
+
environment-file: environment.yml
|
|
43
|
+
condarc: |
|
|
44
|
+
channels:
|
|
45
|
+
- conda-forge
|
|
46
|
+
create-args: >-
|
|
47
|
+
python=${{ env.PYTHON_VERSION }}
|
|
48
|
+
environment-name: prod
|
|
49
|
+
cache-environment: true
|
|
50
|
+
|
|
51
|
+
- name: Build and Test
|
|
52
|
+
run: |
|
|
53
|
+
set -e
|
|
54
|
+
# pip install from requirements.txt
|
|
55
|
+
python -m pip install -r pip_requirements.txt
|
|
56
|
+
python -m pip install . --upgrade --no-deps
|
|
57
|
+
python -m pytest --cov=iembot
|
|
58
|
+
python -m coverage xml
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
- name: Code coverage
|
|
62
|
+
if: ${{ matrix.PYTHON_VERSION == '3.14' }}
|
|
63
|
+
uses: codecov/codecov-action@v5
|
|
64
|
+
with:
|
|
65
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
66
|
+
files: coverage.xml
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: "CodeQL"
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ "main" ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ "main" ]
|
|
8
|
+
schedule:
|
|
9
|
+
- cron: "8 21 * * 1"
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
analyze:
|
|
13
|
+
name: Analyze
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
permissions:
|
|
16
|
+
actions: read
|
|
17
|
+
contents: read
|
|
18
|
+
security-events: write
|
|
19
|
+
|
|
20
|
+
strategy:
|
|
21
|
+
fail-fast: false
|
|
22
|
+
matrix:
|
|
23
|
+
language: [ python ]
|
|
24
|
+
|
|
25
|
+
steps:
|
|
26
|
+
- name: Checkout
|
|
27
|
+
uses: actions/checkout@v6
|
|
28
|
+
|
|
29
|
+
- name: Initialize CodeQL
|
|
30
|
+
uses: github/codeql-action/init@v4
|
|
31
|
+
with:
|
|
32
|
+
languages: ${{ matrix.language }}
|
|
33
|
+
queries: +security-and-quality
|
|
34
|
+
|
|
35
|
+
- name: Autobuild
|
|
36
|
+
uses: github/codeql-action/autobuild@v4
|
|
37
|
+
|
|
38
|
+
- name: Perform CodeQL Analysis
|
|
39
|
+
uses: github/codeql-action/analyze@v4
|
|
40
|
+
with:
|
|
41
|
+
category: "/language:${{ matrix.language }}"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
127.0.0.1 iem.local
|
|
2
|
+
127.0.0.1 iemdb.local
|
|
3
|
+
127.0.0.1 iemdb-hads.local
|
|
4
|
+
127.0.0.1 iemdb-mos.local
|
|
5
|
+
127.0.0.1 iemdb-idep.local
|
|
6
|
+
127.0.0.1 iemdb-iemre.local
|
|
7
|
+
127.0.0.1 iemdb-postgis.local
|
|
8
|
+
127.0.0.1 iemdb-mesosite.local
|
|
9
|
+
127.0.0.1 iemdb-afos.local
|
|
10
|
+
127.0.0.1 iemdb-asos.local
|
|
11
|
+
127.0.0.1 iemdb-hml.local
|
|
12
|
+
127.0.0.1 iemdb-iembot.local
|
|
13
|
+
127.0.0.1 iemdb-nldn.local
|
|
14
|
+
127.0.0.1 iemdb-snet.local
|
|
15
|
+
127.0.0.1 iemdb-mos.local
|
|
16
|
+
127.0.0.1 iemdb-raob.local
|
|
17
|
+
127.0.0.1 iemdb-rwis.local
|
|
18
|
+
127.0.0.1 iemdb-squaw.local
|
|
19
|
+
127.0.0.1 iemdb-awos.local
|
|
20
|
+
127.0.0.1 iemdb-iem.local
|
|
21
|
+
127.0.0.1 iemdb-other.local
|
|
22
|
+
127.0.0.1 iemdb-radar.local
|
|
23
|
+
127.0.0.1 iemdb-scan.local
|
|
24
|
+
127.0.0.1 iemdb-wepp.local
|
|
25
|
+
127.0.0.1 iemdb-coop.local
|
|
26
|
+
127.0.0.1 iemdb-isuag.local
|
|
27
|
+
127.0.0.1 iemdb-portfolio.local
|
|
28
|
+
127.0.0.1 iemdb-smos.local
|
|
29
|
+
127.0.0.1 iemdb-talltowers.local
|
|
30
|
+
127.0.0.1 iemdb-td.local
|
|
31
|
+
127.0.0.1 iemdb-sustainablecorn.local
|
|
32
|
+
127.0.0.1 iemdb-asos1min.local
|
|
33
|
+
127.0.0.1 iem-memcached
|
|
34
|
+
127.0.0.1 iem-web-services.local
|
iembot-0.3.0/.gitignore
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
ci:
|
|
2
|
+
autoupdate_schedule: quarterly
|
|
3
|
+
repos:
|
|
4
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
5
|
+
rev: "v0.15.0"
|
|
6
|
+
hooks:
|
|
7
|
+
- id: ruff
|
|
8
|
+
args: [--fix, --exit-non-zero-on-fix]
|
|
9
|
+
- id: ruff-format
|
|
10
|
+
|
|
11
|
+
- repo: https://github.com/tox-dev/pyproject-fmt
|
|
12
|
+
rev: 'v2.12.1'
|
|
13
|
+
hooks:
|
|
14
|
+
- id: pyproject-fmt
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!-- markdownlint-configure-file {"MD024": { "siblings_only": true } } -->
|
|
2
|
+
# Changelog
|
|
3
|
+
|
|
4
|
+
All notable changes to this library are documented in this file.
|
|
5
|
+
|
|
6
|
+
## Unreleased Version
|
|
7
|
+
|
|
8
|
+
### API Changes
|
|
9
|
+
|
|
10
|
+
### New Features
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
## **0.3.0** (4 Feb 2026)
|
|
15
|
+
|
|
16
|
+
First sane release of this code base onto pypi and hopefully conda-forge.
|
iembot-0.3.0/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2005 Iowa State University
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
iembot-0.3.0/MANIFEST.in
ADDED
iembot-0.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: iembot
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: A poorly written XMPP bot that does other things
|
|
5
|
+
Author-email: daryl herzmann <akrherz@gmail.com>
|
|
6
|
+
License: Apache
|
|
7
|
+
Project-URL: Homepage, https://github.com/akrherz/iembot
|
|
8
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: atproto
|
|
17
|
+
Requires-Dist: click
|
|
18
|
+
Requires-Dist: feedgen
|
|
19
|
+
Requires-Dist: httpx
|
|
20
|
+
Requires-Dist: mastodon-py
|
|
21
|
+
Requires-Dist: psycopg
|
|
22
|
+
Requires-Dist: pyiem>=1.26
|
|
23
|
+
Requires-Dist: python-twitter
|
|
24
|
+
Requires-Dist: requests
|
|
25
|
+
Requires-Dist: service-identity
|
|
26
|
+
Requires-Dist: twisted>=18.4
|
|
27
|
+
Requires-Dist: txyam2
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: cartopy; extra == "dev"
|
|
30
|
+
Requires-Dist: codecov; extra == "dev"
|
|
31
|
+
Requires-Dist: cython; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest-runner; extra == "dev"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
# IEMBOT
|
|
38
|
+
|
|
39
|
+
[](https://readthedocs.org/projects/iembot/)
|
|
40
|
+
[](https://github.com/akrherz/iembot)
|
|
41
|
+
[](https://landscape.io/github/akrherz/iembot/master)
|
|
42
|
+
|
|
43
|
+
I am a XMPP client with limited bot capabilities. In general, I am a message
|
|
44
|
+
router more than anything.
|
|
45
|
+
|
|
46
|
+
## Run iembot in development
|
|
47
|
+
|
|
48
|
+
Place the `src` folder within your `PYTHONPATH` and then `python -m iembot.main run ...`
|
|
49
|
+
|
|
50
|
+
## Run iembot in production
|
|
51
|
+
|
|
52
|
+
Well, don't. If you do, then the CLI is available `iembot run ...`
|
|
53
|
+
|
|
54
|
+
## Command line options
|
|
55
|
+
|
|
56
|
+
Option | Shortname | Default | Doc
|
|
57
|
+
--- | --- | --- | --
|
|
58
|
+
`--disable-atmosphere` | - | `False` | Disable Atmosphere message posting
|
|
59
|
+
`--disable-mastodon` | - | `False` | Disable Mastodon message posting
|
|
60
|
+
`--disable-slack` | - | `False` | Disable Slack message posting
|
|
61
|
+
`--disable-twitter` | - | `False` | Disable Twitter message posting
|
|
62
|
+
`--logfile` | `-l` | `logs/iembot.log` | Where to log to, `-` does stdout only
|
iembot-0.3.0/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# IEMBOT
|
|
2
|
+
|
|
3
|
+
[](https://readthedocs.org/projects/iembot/)
|
|
4
|
+
[](https://github.com/akrherz/iembot)
|
|
5
|
+
[](https://landscape.io/github/akrherz/iembot/master)
|
|
6
|
+
|
|
7
|
+
I am a XMPP client with limited bot capabilities. In general, I am a message
|
|
8
|
+
router more than anything.
|
|
9
|
+
|
|
10
|
+
## Run iembot in development
|
|
11
|
+
|
|
12
|
+
Place the `src` folder within your `PYTHONPATH` and then `python -m iembot.main run ...`
|
|
13
|
+
|
|
14
|
+
## Run iembot in production
|
|
15
|
+
|
|
16
|
+
Well, don't. If you do, then the CLI is available `iembot run ...`
|
|
17
|
+
|
|
18
|
+
## Command line options
|
|
19
|
+
|
|
20
|
+
Option | Shortname | Default | Doc
|
|
21
|
+
--- | --- | --- | --
|
|
22
|
+
`--disable-atmosphere` | - | `False` | Disable Atmosphere message posting
|
|
23
|
+
`--disable-mastodon` | - | `False` | Disable Mastodon message posting
|
|
24
|
+
`--disable-slack` | - | `False` | Disable Slack message posting
|
|
25
|
+
`--disable-twitter` | - | `False` | Disable Twitter message posting
|
|
26
|
+
`--logfile` | `-l` | `logs/iembot.log` | Where to log to, `-` does stdout only
|
iembot-0.3.0/conftest.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""Centralized Testing Stuff."""
|
|
2
|
+
|
|
3
|
+
import random
|
|
4
|
+
from collections import defaultdict
|
|
5
|
+
from unittest import mock
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
from pyiem.database import get_dbconnc
|
|
9
|
+
|
|
10
|
+
from iembot.bot import JabberClient
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@pytest.fixture
|
|
14
|
+
def bot():
|
|
15
|
+
"""A bot."""
|
|
16
|
+
iembot = JabberClient(f"iembot_{random.randint(0, 1000000)}", mock.Mock())
|
|
17
|
+
iembot.config = defaultdict(str)
|
|
18
|
+
iembot.xmlstream = mock.Mock()
|
|
19
|
+
return iembot
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@pytest.fixture
|
|
23
|
+
def dbcursor(database):
|
|
24
|
+
"""Yield a cursor for the given database."""
|
|
25
|
+
dbconn, cursor = get_dbconnc(database, user="mesonet")
|
|
26
|
+
yield cursor
|
|
27
|
+
dbconn.close()
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
dependencies:
|
|
2
|
+
- atproto
|
|
3
|
+
- click
|
|
4
|
+
- codecov
|
|
5
|
+
- httpx
|
|
6
|
+
- requests
|
|
7
|
+
- twisted>=18.4.0
|
|
8
|
+
- psycopg
|
|
9
|
+
- pyiem>=1.26
|
|
10
|
+
- pytest
|
|
11
|
+
- pytest-cov
|
|
12
|
+
- pytest-runner
|
|
13
|
+
# bot non-async twitter
|
|
14
|
+
- python-twitter
|
|
15
|
+
- service_identity
|
|
16
|
+
- setuptools_scm
|
|
17
|
+
# cython is a lame requirement from rabbit hole of cartopy
|
|
18
|
+
- cython
|
|
19
|
+
- cartopy
|
|
20
|
+
- mastodon.py
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
build-backend = "setuptools.build_meta"
|
|
3
|
+
|
|
4
|
+
requires = [ "setuptools>=64", "setuptools-scm>=8" ]
|
|
5
|
+
|
|
6
|
+
[project]
|
|
7
|
+
name = "iembot"
|
|
8
|
+
description = "A poorly written XMPP bot that does other things"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { "text" = "Apache" }
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "daryl herzmann", email = "akrherz@gmail.com" },
|
|
13
|
+
]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
16
|
+
"Programming Language :: Python :: 3.10",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3.13",
|
|
20
|
+
"Programming Language :: Python :: 3.14",
|
|
21
|
+
]
|
|
22
|
+
dynamic = [ "version" ]
|
|
23
|
+
dependencies = [
|
|
24
|
+
"atproto",
|
|
25
|
+
"click",
|
|
26
|
+
"feedgen",
|
|
27
|
+
"httpx",
|
|
28
|
+
"mastodon-py",
|
|
29
|
+
"psycopg",
|
|
30
|
+
"pyiem>=1.26",
|
|
31
|
+
"python-twitter",
|
|
32
|
+
"requests",
|
|
33
|
+
"service-identity",
|
|
34
|
+
"twisted>=18.4",
|
|
35
|
+
"txyam2",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
optional-dependencies.dev = [
|
|
39
|
+
"cartopy",
|
|
40
|
+
"codecov",
|
|
41
|
+
"cython",
|
|
42
|
+
"pytest",
|
|
43
|
+
"pytest-cov",
|
|
44
|
+
"pytest-runner",
|
|
45
|
+
]
|
|
46
|
+
urls."Homepage" = "https://github.com/akrherz/iembot"
|
|
47
|
+
scripts.iembot = "iembot.main:main"
|
|
48
|
+
|
|
49
|
+
[tool.setuptools]
|
|
50
|
+
package-dir = { "" = "src" }
|
|
51
|
+
include-package-data = true
|
|
52
|
+
|
|
53
|
+
[tool.setuptools.package-data]
|
|
54
|
+
"iembot" = [ "data/startrek" ]
|
|
55
|
+
|
|
56
|
+
[tool.setuptools_scm]
|
|
57
|
+
version_scheme = "post-release"
|
|
58
|
+
|
|
59
|
+
[tool.ruff]
|
|
60
|
+
target-version = "py310"
|
|
61
|
+
|
|
62
|
+
line-length = 79
|
|
63
|
+
lint.select = [
|
|
64
|
+
"A", # builtins
|
|
65
|
+
"ARG", # unused args
|
|
66
|
+
"ASYNC", # async
|
|
67
|
+
"B", # bugbear
|
|
68
|
+
# "BLE", # blind except
|
|
69
|
+
"C4", # comprehensions
|
|
70
|
+
# "C90", # mccabe
|
|
71
|
+
# "COM", # commas
|
|
72
|
+
# "DTZ", # datetime
|
|
73
|
+
"E", # pycodestyle
|
|
74
|
+
# "EM", # flake8-errmsg
|
|
75
|
+
"ERA", # eradicate
|
|
76
|
+
"EXE", # shebang
|
|
77
|
+
"F", # pyflakes
|
|
78
|
+
"FLY", # fly
|
|
79
|
+
# "FBT", # flake8-boolean-trap
|
|
80
|
+
# "FIX", # has fixme
|
|
81
|
+
"FURB", # refurb
|
|
82
|
+
"G", # logging-format
|
|
83
|
+
"I", # isort
|
|
84
|
+
"ICN", # implicit-conv
|
|
85
|
+
"INT", # flake8-gettext
|
|
86
|
+
"ISC", # implicit-str-concat
|
|
87
|
+
"LOG", # logging
|
|
88
|
+
# "N", # naming
|
|
89
|
+
"NPY", # numpy
|
|
90
|
+
"PERF", # performance
|
|
91
|
+
# "PD", # pandas-vet
|
|
92
|
+
"PIE", # flake8-pie
|
|
93
|
+
"PLE", # pylint error
|
|
94
|
+
# "PLR", # pylint refactoring
|
|
95
|
+
"PLW", # pylint warning
|
|
96
|
+
"PT", # pytest style
|
|
97
|
+
# "PTH", # pathlib
|
|
98
|
+
"PYI", # pyi
|
|
99
|
+
"Q", # flake8-quotes
|
|
100
|
+
# "RET", # flake8-return
|
|
101
|
+
"RSE", # raise
|
|
102
|
+
"RUF", # ruff specific
|
|
103
|
+
# "S", # bandit
|
|
104
|
+
# "S608", # SQL injection
|
|
105
|
+
# "SIM", # simplify
|
|
106
|
+
"T20", # print
|
|
107
|
+
"TC", # type checking
|
|
108
|
+
"TID", # tidy imports
|
|
109
|
+
# "TRY", # try-except-raise
|
|
110
|
+
"UP", # pyupgrade
|
|
111
|
+
"W", # pycodestyle
|
|
112
|
+
"YTT", # flake8-2020
|
|
113
|
+
]
|
|
114
|
+
|
|
115
|
+
lint.per-file-ignores."tests/**/*.py" = [
|
|
116
|
+
"S101", # assert
|
|
117
|
+
]
|
|
118
|
+
lint.per-file-ignores."{scripts,tests}/**/*.py" = [
|
|
119
|
+
"T20", # print
|
|
120
|
+
]
|
iembot-0.3.0/run.sh
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
if [ -e iembot.pid ]; then
|
|
4
|
+
kill -INT "$(cat iembot.pid)"
|
|
5
|
+
sleep 5
|
|
6
|
+
if [ -e iembot.pid ]; then
|
|
7
|
+
echo 'IEMBot still alive? kill -9 this time'
|
|
8
|
+
kill -9 "$(cat iembot.pid)"
|
|
9
|
+
sleep 1
|
|
10
|
+
rm -f iembot.pid
|
|
11
|
+
fi
|
|
12
|
+
fi
|
|
13
|
+
if [ "$(whoami)" = "akrherz" ]; then
|
|
14
|
+
echo "Setting custom SSL_CERT_FILE"
|
|
15
|
+
export SSL_CERT_FILE=/etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
python -m iembot.main run -c settings_laptop.json --logfile=- "$@"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""Remove a twitter user's oauth tokens and reload iembot"""
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
import requests
|
|
6
|
+
from pyiem.database import get_dbconnc
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def main(argv):
|
|
10
|
+
"""Run for a given username"""
|
|
11
|
+
screen_name = argv[1]
|
|
12
|
+
pgconn, cursor = get_dbconnc("openfire")
|
|
13
|
+
cursor.execute(
|
|
14
|
+
"""
|
|
15
|
+
DELETE from iembot_twitter_oauth where screen_name = %s
|
|
16
|
+
""",
|
|
17
|
+
(screen_name,),
|
|
18
|
+
)
|
|
19
|
+
print(
|
|
20
|
+
f"Removed {cursor.rowcount} entries from the database "
|
|
21
|
+
f"for screen name '{screen_name}'"
|
|
22
|
+
)
|
|
23
|
+
cursor.close()
|
|
24
|
+
pgconn.commit()
|
|
25
|
+
|
|
26
|
+
uri = "http://iembot:9003/reload"
|
|
27
|
+
req = requests.get(uri, timeout=30)
|
|
28
|
+
print(f"reloading iembot {req.text}")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
if __name__ == "__main__":
|
|
32
|
+
main(sys.argv)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"bot.dbname": "iembot",
|
|
3
|
+
"bot.dbhost": "localhost",
|
|
4
|
+
"bot.dbuser": "iembot",
|
|
5
|
+
"bot.username": "iembot",
|
|
6
|
+
"bot.password": "...",
|
|
7
|
+
"bot.xmppdomain": "localhost",
|
|
8
|
+
"bot.connecthost": "localhost",
|
|
9
|
+
"bot.mucservice": "conference.localhost",
|
|
10
|
+
"bot.ingest_username": "iembot_ingest",
|
|
11
|
+
"bot.slack.client_id": "...",
|
|
12
|
+
"bot.slack.client_secret": "...",
|
|
13
|
+
"bot.slack.redirect_uri": "...",
|
|
14
|
+
"bot.twitter.consumerkey": "...",
|
|
15
|
+
"bot.twitter.consumersecret": "...",
|
|
16
|
+
"bot.purge_xmllog_days": 7,
|
|
17
|
+
"bot.email_errors_from": "iembot@localhost",
|
|
18
|
+
"bot.email_errors_to": "root@localhost",
|
|
19
|
+
"bot.smtp_server": "localhost"
|
|
20
|
+
}
|
iembot-0.3.0/setup.cfg
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""Placeholder."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import NamedTuple
|
|
7
|
+
|
|
8
|
+
try:
|
|
9
|
+
__version__ = version("iembot")
|
|
10
|
+
pkgdir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
|
11
|
+
if not pkgdir.endswith("site-packages"):
|
|
12
|
+
__version__ += "-dev"
|
|
13
|
+
except PackageNotFoundError:
|
|
14
|
+
# package is not installed
|
|
15
|
+
__version__ = "dev"
|
|
16
|
+
|
|
17
|
+
DATADIR = Path(__file__).parent / "data"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class ROOM_LOG_ENTRY(NamedTuple):
|
|
21
|
+
seqnum: int
|
|
22
|
+
timestamp: str
|
|
23
|
+
log: str
|
|
24
|
+
author: str
|
|
25
|
+
product_id: str
|
|
26
|
+
product_text: str
|
|
27
|
+
txtlog: str
|