上传文件至 /
This commit is contained in:
24
WebArticle.py
Normal file
24
WebArticle.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
from ProjectCfg import DOMAIN
|
||||||
|
from .CallServer import _make_request
|
||||||
|
|
||||||
|
###==========================网页文章==========================
|
||||||
|
|
||||||
|
def GetWebArticle(feedid:str,publisherid:str,limit:int=20,offset:int=0,Authorization: str='' ) -> dict:
|
||||||
|
"""获取网页文章"""
|
||||||
|
url = f"{DOMAIN}/feeds/articles"
|
||||||
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
||||||
|
params = {"feedid":feedid,"publisherid":publisherid,"limit":limit,"offset":offset}
|
||||||
|
return _make_request('GET', url, headers,params=params)
|
||||||
|
|
||||||
|
def GetWebArticleDetail(articleid:str,Authorization: str='' ) -> dict:
|
||||||
|
"""获取网页文章详情"""
|
||||||
|
url = f"{DOMAIN}/feeds/articles/{articleid}"
|
||||||
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
||||||
|
return _make_request('GET', url, headers)
|
||||||
|
|
||||||
|
def RandomWebArticle(Authorization: str='',limit:int=5 ) -> dict:
|
||||||
|
"""随机获取网页文章"""
|
||||||
|
url = f"{DOMAIN}/feeds/articles/random"
|
||||||
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
||||||
|
params = {"limit":limit}
|
||||||
|
return _make_request('GET', url, headers,params=params)
|
57
WebFeed.py
Normal file
57
WebFeed.py
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
from ProjectCfg import DOMAIN
|
||||||
|
from .CallServer import _make_request
|
||||||
|
|
||||||
|
###==========================网页流==========================
|
||||||
|
|
||||||
|
def GetWebFeed(pubname:str,Authorization: str='') -> dict:
|
||||||
|
"""获取网页流"""
|
||||||
|
url = f"{DOMAIN}/publishers/{pubname}/feeds"
|
||||||
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
||||||
|
return _make_request('GET', url, headers)
|
||||||
|
|
||||||
|
|
||||||
|
def SendWebFeed(pubname:str,Authorization: str='',URL:str='',Title:str='',Description:str='',ScrapPage:bool=True) -> dict:
|
||||||
|
"""发送网页流"""
|
||||||
|
url = f"{DOMAIN}/publishers/{pubname}/feeds"
|
||||||
|
RequestsBody={
|
||||||
|
"url": URL,
|
||||||
|
"title": Title,
|
||||||
|
"description": Description,
|
||||||
|
"config": {
|
||||||
|
"scrap_page": ScrapPage,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
||||||
|
return _make_request('POST', url, headers,request_body=RequestsBody,normal_codes=[201])
|
||||||
|
|
||||||
|
def GetWebFeedDetail(feedid:str,pubname:str,Authorization: str='') -> dict:
|
||||||
|
"""获取网页流详情"""
|
||||||
|
url = f"{DOMAIN}/publishers/{pubname}/feeds/{feedid}"
|
||||||
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
||||||
|
return _make_request('GET', url, headers)
|
||||||
|
|
||||||
|
def ModifyWebFeed(feedid:str,pubname:str,Authorization: str='',URL:str='',Title:str='',Description:str='',ScrapPage:bool=True) -> dict:
|
||||||
|
"""修改网页流"""
|
||||||
|
url = f"{DOMAIN}/publishers/{pubname}/feeds/{feedid}"
|
||||||
|
RequestsBody={
|
||||||
|
"url": URL,
|
||||||
|
"title": Title,
|
||||||
|
"description": Description,
|
||||||
|
"config": {
|
||||||
|
"scrap_page": ScrapPage,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
||||||
|
return _make_request('PATCH', url, headers,request_body=RequestsBody,normal_codes=[200])
|
||||||
|
|
||||||
|
def DeleteWebFeed(feedid:str,pubname:str,Authorization: str='') -> dict:
|
||||||
|
"""删除网页流"""
|
||||||
|
url = f"{DOMAIN}/publishers/{pubname}/feeds/{feedid}"
|
||||||
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
||||||
|
return _make_request('DELETE', url, headers,normal_codes=[204])
|
||||||
|
|
||||||
|
def SetScrapPage(pubname:str,id:str,Authorization: str='') -> dict:
|
||||||
|
"""设置是否采集网页"""
|
||||||
|
url = f"{DOMAIN}/publishers/{pubname}/feeds/{id}/scrap"
|
||||||
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
||||||
|
return _make_request('POST', url, headers,normal_codes=[201])
|
56
WebFeedPublic.py
Normal file
56
WebFeedPublic.py
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
from ProjectCfg import DOMAIN
|
||||||
|
from .CallServer import _make_request
|
||||||
|
|
||||||
|
###==========================公共网页流==========================
|
||||||
|
|
||||||
|
def SubscribeWebFeed(feedid:str,Authorization: str) -> dict:
|
||||||
|
"""订阅公共网页流"""
|
||||||
|
url = f"{DOMAIN}/feeds/{feedid}/subscribe"
|
||||||
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
||||||
|
return _make_request('POST', url, headers,normal_codes=[201])
|
||||||
|
|
||||||
|
def UnsubscribeWebFeed(feedid:str,Authorization: str) -> dict:
|
||||||
|
"""取消订阅公共网页流"""
|
||||||
|
url = f"{DOMAIN}/feeds/{feedid}/subscribe"
|
||||||
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
||||||
|
return _make_request('DELETE', url, headers,normal_codes=[204])
|
||||||
|
|
||||||
|
def GetWebFeedSubscription(feedid:str,Authorization: str='') -> dict:
|
||||||
|
"""获取公共网页流订阅"""
|
||||||
|
url = f"{DOMAIN}/feeds/{feedid}/subscribe"
|
||||||
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
||||||
|
return _make_request('GET', url, headers)
|
||||||
|
|
||||||
|
def GetWebFeedSubscribed(offset:int=0,take:int=20,Authorization: str='') -> dict:
|
||||||
|
"""获取公共网页流订阅"""
|
||||||
|
url = f"{DOMAIN}/feeds/subscribed"
|
||||||
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
||||||
|
params = {"offset":offset,"take":take}
|
||||||
|
return _make_request('GET', url, headers,params=params)
|
||||||
|
|
||||||
|
def GetWebFeedInfo(offset:int=0,take:int=20,Authorization: str='') -> dict:
|
||||||
|
"""获取公共网页流信息"""
|
||||||
|
url = f"{DOMAIN}/feeds"
|
||||||
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
||||||
|
params = {"offset":offset,"take":take}
|
||||||
|
return _make_request('GET', url, headers,params=params)
|
||||||
|
|
||||||
|
def GetWebFeedDetail(feedid:str,Authorization: str='') -> dict:
|
||||||
|
"""获取公共网页流详情"""
|
||||||
|
url = f"{DOMAIN}/feeds/{feedid}"
|
||||||
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
||||||
|
return _make_request('GET', url, headers)
|
||||||
|
|
||||||
|
def GetWebFeedArticles(feedid:str,offset:int=0,take:int=20,Authorization: str='') -> dict:
|
||||||
|
"""获取公共网页流文章"""
|
||||||
|
url = f"{DOMAIN}/feeds/{feedid}/articles"
|
||||||
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
||||||
|
params = {"offset":offset,"take":take}
|
||||||
|
return _make_request('GET', url, headers,params=params)
|
||||||
|
|
||||||
|
def GetWebFeedExplore(offset:int=0,take:int=20,query='',Authorization: str='') -> dict:
|
||||||
|
"""获取公共网页流探索"""
|
||||||
|
url = f"{DOMAIN}/feeds/explore"
|
||||||
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
||||||
|
params = {"offset":offset,"take":take,"query":query}
|
||||||
|
return _make_request('GET', url, headers,params=params)
|
23
WebReader.py
Normal file
23
WebReader.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
from ProjectCfg import DOMAIN
|
||||||
|
from .CallServer import _make_request
|
||||||
|
|
||||||
|
###==========================网页阅读器==========================
|
||||||
|
def ReadForURL(url:str,Authorization: str='' ) -> dict:
|
||||||
|
"""通过URL读取网页"""
|
||||||
|
url = f"{DOMAIN}/scrap/link"
|
||||||
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
||||||
|
params = {"url":url}
|
||||||
|
return _make_request('GET', url, headers,params=params)
|
||||||
|
|
||||||
|
def ClearReaderCache(url:str,Authorization: str='') -> dict:
|
||||||
|
"""清除缓存"""
|
||||||
|
url = f"{DOMAIN}/scrap/link/cache"
|
||||||
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
||||||
|
params = {"url":url}
|
||||||
|
return _make_request('DELETE', url, headers,params=params)
|
||||||
|
|
||||||
|
def ClearAllReaderCache(Authorization: str='') -> dict:
|
||||||
|
"""清除所有缓存"""
|
||||||
|
url = f"{DOMAIN}/scrap/cache/all"
|
||||||
|
headers = {'accept': 'application/json', 'Authorization': Authorization}
|
||||||
|
return _make_request('DELETE', url, headers)
|
Reference in New Issue
Block a user