missionpanel 1.1.0__tar.gz → 1.1.3__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.0 → missionpanel-1.1.3}/PKG-INFO +1 -1
  2. {missionpanel-1.1.0 → missionpanel-1.1.3}/missionpanel/example/ttrss.py +11 -5
  3. {missionpanel-1.1.0 → missionpanel-1.1.3}/missionpanel.egg-info/PKG-INFO +1 -1
  4. {missionpanel-1.1.0 → missionpanel-1.1.3}/setup.py +1 -1
  5. {missionpanel-1.1.0 → missionpanel-1.1.3}/LICENSE +0 -0
  6. {missionpanel-1.1.0 → missionpanel-1.1.3}/README.md +0 -0
  7. {missionpanel-1.1.0 → missionpanel-1.1.3}/missionpanel/__init__.py +0 -0
  8. {missionpanel-1.1.0 → missionpanel-1.1.3}/missionpanel/example/__init__.py +0 -0
  9. {missionpanel-1.1.0 → missionpanel-1.1.3}/missionpanel/example/rsshub.py +0 -0
  10. {missionpanel-1.1.0 → missionpanel-1.1.3}/missionpanel/handler/__init__.py +0 -0
  11. {missionpanel-1.1.0 → missionpanel-1.1.3}/missionpanel/handler/handler.py +0 -0
  12. {missionpanel-1.1.0 → missionpanel-1.1.3}/missionpanel/orm/__init__.py +0 -0
  13. {missionpanel-1.1.0 → missionpanel-1.1.3}/missionpanel/orm/core.py +0 -0
  14. {missionpanel-1.1.0 → missionpanel-1.1.3}/missionpanel/orm/handler.py +0 -0
  15. {missionpanel-1.1.0 → missionpanel-1.1.3}/missionpanel/submitter/__init__.py +0 -0
  16. {missionpanel-1.1.0 → missionpanel-1.1.3}/missionpanel/submitter/abc.py +0 -0
  17. {missionpanel-1.1.0 → missionpanel-1.1.3}/missionpanel/submitter/asynchronous.py +0 -0
  18. {missionpanel-1.1.0 → missionpanel-1.1.3}/missionpanel/submitter/submitter.py +0 -0
  19. {missionpanel-1.1.0 → missionpanel-1.1.3}/missionpanel.egg-info/SOURCES.txt +0 -0
  20. {missionpanel-1.1.0 → missionpanel-1.1.3}/missionpanel.egg-info/dependency_links.txt +0 -0
  21. {missionpanel-1.1.0 → missionpanel-1.1.3}/missionpanel.egg-info/requires.txt +0 -0
  22. {missionpanel-1.1.0 → missionpanel-1.1.3}/missionpanel.egg-info/top_level.txt +0 -0
  23. {missionpanel-1.1.0 → missionpanel-1.1.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: missionpanel
3
- Version: 1.1.0
3
+ Version: 1.1.3
4
4
  Summary: A mission panel
5
5
  Home-page: https://github.com/yindaheng98/missionpanel
6
6
  Author: yindaheng98
@@ -2,7 +2,7 @@ import abc
2
2
  import asyncio
3
3
  import json
4
4
  import logging
5
- from typing import Any, AsyncGenerator, Dict, List
5
+ from typing import Any, AsyncGenerator, Dict, List, Union
6
6
  import httpx
7
7
  from xml.etree import ElementTree
8
8
  from missionpanel.submitter import AsyncSubmitter
@@ -107,13 +107,19 @@ class TTRSSHubSubmitter(TTRSSSubmitter):
107
107
  logger = logging.getLogger("TTRSSHubSubmitter")
108
108
 
109
109
  @abc.abstractmethod
110
- async def parse_xml(self, xml: str) -> AsyncGenerator[Any, None]:
110
+ async def parse_xml(self, xml: str, feed: dict, content: dict) -> AsyncGenerator[Any, None]:
111
111
  pass
112
112
 
113
+ async def preprocess(self, feed: dict, content: dict) -> Union[Dict, None]:
114
+ return feed
115
+
113
116
  async def parse_content_nocatch(self, feed: dict, content: dict, **httpx_client_options) -> AsyncGenerator[Any, None]:
117
+ feed = await self.preprocess(feed, content)
118
+ if feed is None:
119
+ return
114
120
  async with httpx.AsyncClient(**httpx_client_options) as client:
115
121
  response = await client.get(feed['feed_url'])
116
- async for mission_content in self.parse_xml(response.text):
122
+ async for mission_content in self.parse_xml(response.text, feed, content):
117
123
  yield mission_content
118
124
 
119
125
  async def parse_content(self, feed: dict, content: dict, **httpx_client_options) -> AsyncGenerator[Any, None]:
@@ -126,7 +132,7 @@ class TTRSSHubSubmitter(TTRSSSubmitter):
126
132
 
127
133
  class TTRRSSHubRootSubmitter(TTRSSHubSubmitter):
128
134
 
129
- async def parse_xml(self, xml: str) -> AsyncGenerator[str, None]:
135
+ async def parse_xml(self, xml: str, feed: dict, content: dict) -> AsyncGenerator[str, None]:
130
136
  root = ElementTree.XML(xml)
131
137
  yield {
132
138
  'url': root.find('channel/link').text,
@@ -136,7 +142,7 @@ class TTRRSSHubRootSubmitter(TTRSSHubSubmitter):
136
142
 
137
143
  class TTRRSSHubSubitemSubmitter(TTRSSHubSubmitter):
138
144
 
139
- async def parse_xml(self, xml: str) -> AsyncGenerator[str, None]:
145
+ async def parse_xml(self, xml: str, feed: dict, content: dict) -> AsyncGenerator[str, None]:
140
146
  root = ElementTree.XML(xml)
141
147
  for item in root.find('channel').iter('item'):
142
148
  yield {'url': item.find('link').text}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: missionpanel
3
- Version: 1.1.0
3
+ Version: 1.1.3
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.0',
15
+ version='1.1.3',
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