missionpanel 1.1.6__tar.gz → 1.2.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.
- {missionpanel-1.1.6 → missionpanel-1.2.0}/PKG-INFO +1 -1
- {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/example/__init__.py +1 -1
- {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/example/ttrss.py +11 -4
- {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel.egg-info/PKG-INFO +1 -1
- {missionpanel-1.1.6 → missionpanel-1.2.0}/setup.py +1 -1
- {missionpanel-1.1.6 → missionpanel-1.2.0}/LICENSE +0 -0
- {missionpanel-1.1.6 → missionpanel-1.2.0}/README.md +0 -0
- {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/__init__.py +0 -0
- {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/example/rsshub.py +0 -0
- {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/handler/__init__.py +0 -0
- {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/handler/handler.py +0 -0
- {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/orm/__init__.py +0 -0
- {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/orm/core.py +0 -0
- {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/orm/handler.py +0 -0
- {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/submitter/__init__.py +0 -0
- {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/submitter/abc.py +0 -0
- {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/submitter/asynchronous.py +0 -0
- {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/submitter/submitter.py +0 -0
- {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel.egg-info/SOURCES.txt +0 -0
- {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel.egg-info/dependency_links.txt +0 -0
- {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel.egg-info/requires.txt +0 -0
- {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel.egg-info/top_level.txt +0 -0
- {missionpanel-1.1.6 → missionpanel-1.2.0}/setup.cfg +0 -0
@@ -1,2 +1,2 @@
|
|
1
1
|
from .rsshub import RSSHubSubmitter, RSSHubRootSubmitter, RSSHubSubitemSubmitter
|
2
|
-
from .ttrss import TTRSSClient, TTRSSSubmitter, TTRSSHubSubmitter,
|
2
|
+
from .ttrss import TTRSSClient, TTRSSSubmitter, TTRSSHubSubmitter, TTRSSHubRootSubmitter, TTRSSHubSubitemSubmitter
|
@@ -80,14 +80,15 @@ class TTRSSSubmitter(AsyncSubmitter, metaclass=abc.ABCMeta):
|
|
80
80
|
async def derive_matcher(self, mission_content) -> List[str]:
|
81
81
|
return [mission_content['url']]
|
82
82
|
|
83
|
-
async def create_missions(self, url: str, username: str, password: str, cat_id: int, **httpx_client_options):
|
83
|
+
async def create_missions(self, url: str, username: str, password: str, cat_id: int, semaphore=asyncio.Semaphore(3), **httpx_client_options):
|
84
84
|
async with TTRSSClient(url, username, password, **httpx_client_options) as client:
|
85
85
|
feeds = await client.api({
|
86
86
|
"op": "getFeeds",
|
87
87
|
"cat_id": cat_id,
|
88
88
|
"limit": None
|
89
89
|
})
|
90
|
-
|
90
|
+
|
91
|
+
async def feed_task(feed):
|
91
92
|
content = await client.api({
|
92
93
|
"op": "getHeadlines",
|
93
94
|
"feed_id": feed['id'],
|
@@ -102,6 +103,12 @@ class TTRSSSubmitter(AsyncSubmitter, metaclass=abc.ABCMeta):
|
|
102
103
|
if len(tags) > 0:
|
103
104
|
await self.add_tags(matchers, tags)
|
104
105
|
|
106
|
+
async def semaphore_task(feed):
|
107
|
+
async with semaphore:
|
108
|
+
await feed_task(feed)
|
109
|
+
|
110
|
+
await asyncio.gather(*[semaphore_task(feed) for feed in feeds])
|
111
|
+
|
105
112
|
|
106
113
|
class TTRSSHubSubmitter(TTRSSSubmitter):
|
107
114
|
logger = logging.getLogger("TTRSSHubSubmitter")
|
@@ -130,7 +137,7 @@ class TTRSSHubSubmitter(TTRSSSubmitter):
|
|
130
137
|
self.logger.warning(f'parse content failed, error: {e}')
|
131
138
|
|
132
139
|
|
133
|
-
class
|
140
|
+
class TTRSSHubRootSubmitter(TTRSSHubSubmitter):
|
134
141
|
|
135
142
|
async def parse_xml(self, xml: str, feed: dict, content: dict) -> AsyncGenerator[dict, Any]:
|
136
143
|
root = ElementTree.XML(xml)
|
@@ -141,7 +148,7 @@ class TTRRSSHubRootSubmitter(TTRSSHubSubmitter):
|
|
141
148
|
}
|
142
149
|
|
143
150
|
|
144
|
-
class
|
151
|
+
class TTRSSHubSubitemSubmitter(TTRSSHubSubmitter):
|
145
152
|
|
146
153
|
async def parse_xml(self, xml: str, feed: dict, content: dict) -> AsyncGenerator[dict, Any]:
|
147
154
|
root = ElementTree.XML(xml)
|
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
|