missionpanel 1.2.3.1__tar.gz → 1.2.5__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.
- {missionpanel-1.2.3.1 → missionpanel-1.2.5}/PKG-INFO +1 -1
- {missionpanel-1.2.3.1 → missionpanel-1.2.5}/missionpanel/example/rsshub.py +10 -5
- {missionpanel-1.2.3.1 → missionpanel-1.2.5}/missionpanel/handler/handler.py +14 -4
- {missionpanel-1.2.3.1 → missionpanel-1.2.5}/missionpanel.egg-info/PKG-INFO +1 -1
- {missionpanel-1.2.3.1 → missionpanel-1.2.5}/setup.py +1 -1
- {missionpanel-1.2.3.1 → missionpanel-1.2.5}/LICENSE +0 -0
- {missionpanel-1.2.3.1 → missionpanel-1.2.5}/README.md +0 -0
- {missionpanel-1.2.3.1 → missionpanel-1.2.5}/missionpanel/__init__.py +0 -0
- {missionpanel-1.2.3.1 → missionpanel-1.2.5}/missionpanel/example/__init__.py +0 -0
- {missionpanel-1.2.3.1 → missionpanel-1.2.5}/missionpanel/example/ttrss.py +0 -0
- {missionpanel-1.2.3.1 → missionpanel-1.2.5}/missionpanel/handler/__init__.py +0 -0
- {missionpanel-1.2.3.1 → missionpanel-1.2.5}/missionpanel/orm/__init__.py +0 -0
- {missionpanel-1.2.3.1 → missionpanel-1.2.5}/missionpanel/orm/core.py +0 -0
- {missionpanel-1.2.3.1 → missionpanel-1.2.5}/missionpanel/orm/handler.py +0 -0
- {missionpanel-1.2.3.1 → missionpanel-1.2.5}/missionpanel/submitter/__init__.py +0 -0
- {missionpanel-1.2.3.1 → missionpanel-1.2.5}/missionpanel/submitter/abc.py +0 -0
- {missionpanel-1.2.3.1 → missionpanel-1.2.5}/missionpanel/submitter/asynchronous.py +0 -0
- {missionpanel-1.2.3.1 → missionpanel-1.2.5}/missionpanel/submitter/submitter.py +0 -0
- {missionpanel-1.2.3.1 → missionpanel-1.2.5}/missionpanel.egg-info/SOURCES.txt +0 -0
- {missionpanel-1.2.3.1 → missionpanel-1.2.5}/missionpanel.egg-info/dependency_links.txt +0 -0
- {missionpanel-1.2.3.1 → missionpanel-1.2.5}/missionpanel.egg-info/requires.txt +0 -0
- {missionpanel-1.2.3.1 → missionpanel-1.2.5}/missionpanel.egg-info/top_level.txt +0 -0
- {missionpanel-1.2.3.1 → missionpanel-1.2.5}/setup.cfg +0 -0
@@ -1,11 +1,13 @@
|
|
1
1
|
import abc
|
2
2
|
from typing import AsyncGenerator, List, Any
|
3
3
|
import httpx
|
4
|
+
import logging
|
4
5
|
from xml.etree import ElementTree
|
5
6
|
from missionpanel.submitter import AsyncSubmitter
|
6
7
|
|
7
8
|
|
8
9
|
class RSSHubSubmitter(AsyncSubmitter, metaclass=abc.ABCMeta):
|
10
|
+
logger = logging.getLogger("RSSHubSubmitter")
|
9
11
|
|
10
12
|
@abc.abstractmethod
|
11
13
|
async def parse_xml(self, xml: str) -> AsyncGenerator[dict, Any]:
|
@@ -21,11 +23,14 @@ class RSSHubSubmitter(AsyncSubmitter, metaclass=abc.ABCMeta):
|
|
21
23
|
async with httpx.AsyncClient(**httpx_client_options) as client:
|
22
24
|
response = await client.get(rsshub)
|
23
25
|
async for mission_content in self.parse_xml(response.text):
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
try:
|
27
|
+
matchers = await self.derive_matcher(mission_content)
|
28
|
+
await self.create_mission(mission_content, matchers)
|
29
|
+
tags = await self.derive_tags(mission_content)
|
30
|
+
if len(tags) > 0:
|
31
|
+
await self.add_tags(matchers, tags)
|
32
|
+
except Exception as e:
|
33
|
+
self.logger.warning(f'create mission failed, error: {e}')
|
29
34
|
|
30
35
|
|
31
36
|
class RSSHubRootSubmitter(RSSHubSubmitter):
|
@@ -96,14 +96,24 @@ class AsyncHandler(HandlerInterface, abc.ABC):
|
|
96
96
|
async def execute_mission(self, mission: Mission, attempt: Attempt) -> bool:
|
97
97
|
pass
|
98
98
|
|
99
|
-
async def
|
99
|
+
async def get_mission(self, tags: List[str]) -> Optional[Mission]:
|
100
100
|
missions = (await self.session.execute(HandlerInterface.query_todo_missions(tags))).scalars().all()
|
101
|
-
|
102
|
-
|
103
|
-
|
101
|
+
return await self.select_mission(missions)
|
102
|
+
|
103
|
+
async def run_mission(self, mission: Mission):
|
104
104
|
attempt = HandlerInterface.create_attempt(self.session, mission, self.name, self.max_time_interval)
|
105
105
|
await self.report_attempt(mission, attempt)
|
106
106
|
if await self.execute_mission(mission, attempt):
|
107
107
|
attempt.success = True
|
108
108
|
await self.report_attempt(mission, attempt)
|
109
109
|
return attempt
|
110
|
+
|
111
|
+
async def run_once(self, tags: List[str]):
|
112
|
+
mission = await self.get_mission(tags)
|
113
|
+
if mission is None:
|
114
|
+
return
|
115
|
+
return await self.run_mission(mission)
|
116
|
+
|
117
|
+
async def run_all(self, tags: List[str]):
|
118
|
+
while await self.run_once(tags):
|
119
|
+
pass
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|