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.
Files changed (23) hide show
  1. {missionpanel-1.1.6 → missionpanel-1.2.0}/PKG-INFO +1 -1
  2. {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/example/__init__.py +1 -1
  3. {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/example/ttrss.py +11 -4
  4. {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel.egg-info/PKG-INFO +1 -1
  5. {missionpanel-1.1.6 → missionpanel-1.2.0}/setup.py +1 -1
  6. {missionpanel-1.1.6 → missionpanel-1.2.0}/LICENSE +0 -0
  7. {missionpanel-1.1.6 → missionpanel-1.2.0}/README.md +0 -0
  8. {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/__init__.py +0 -0
  9. {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/example/rsshub.py +0 -0
  10. {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/handler/__init__.py +0 -0
  11. {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/handler/handler.py +0 -0
  12. {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/orm/__init__.py +0 -0
  13. {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/orm/core.py +0 -0
  14. {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/orm/handler.py +0 -0
  15. {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/submitter/__init__.py +0 -0
  16. {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/submitter/abc.py +0 -0
  17. {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/submitter/asynchronous.py +0 -0
  18. {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel/submitter/submitter.py +0 -0
  19. {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel.egg-info/SOURCES.txt +0 -0
  20. {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel.egg-info/dependency_links.txt +0 -0
  21. {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel.egg-info/requires.txt +0 -0
  22. {missionpanel-1.1.6 → missionpanel-1.2.0}/missionpanel.egg-info/top_level.txt +0 -0
  23. {missionpanel-1.1.6 → missionpanel-1.2.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: missionpanel
3
- Version: 1.1.6
3
+ Version: 1.2.0
4
4
  Summary: A mission panel
5
5
  Home-page: https://github.com/yindaheng98/missionpanel
6
6
  Author: yindaheng98
@@ -1,2 +1,2 @@
1
1
  from .rsshub import RSSHubSubmitter, RSSHubRootSubmitter, RSSHubSubitemSubmitter
2
- from .ttrss import TTRSSClient, TTRSSSubmitter, TTRSSHubSubmitter, TTRRSSHubRootSubmitter, TTRRSSHubSubitemSubmitter
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
- for feed in feeds:
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 TTRRSSHubRootSubmitter(TTRSSHubSubmitter):
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 TTRRSSHubSubitemSubmitter(TTRSSHubSubmitter):
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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: missionpanel
3
- Version: 1.1.6
3
+ Version: 1.2.0
4
4
  Summary: A mission panel
5
5
  Home-page: https://github.com/yindaheng98/missionpanel
6
6
  Author: yindaheng98
@@ -12,7 +12,7 @@ package_dir = {
12
12
 
13
13
  setup(
14
14
  name='missionpanel',
15
- version='1.1.6',
15
+ version='1.2.0',
16
16
  author='yindaheng98',
17
17
  author_email='yindaheng98@gmail.com',
18
18
  url='https://github.com/yindaheng98/missionpanel',
File without changes
File without changes
File without changes