You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library contains the basic API operations like
Number of Index Book
Current page quality status
Proofreader of page
Validator of page
It is wikisource dedicated API library.
Installation
pip install pywikisource
Demo 1
frompywikisourceimportWikiSourceApi# Create the Wikisource objectWS=WikiSourceApi('en')
# oruserAgent="MyCoolTool/1.1 (https://example.org/MyCoolTool/; MyCoolTool@example.org) pywikisource/0.0.4"WS=WikiSourceApi('en', userAgent) # It is recommended to add user agent.# Get page listpageList=WS.createdPageList('Landon in Literary Gazette 1833.pdf')
forpageinpageList:
print(page)
# Get the number of pages of Index Bookprint(WS.numpage('Landon in Literary Gazette 1833.pdf'))
# Get the proofreader of single pageprint(WS.proofreader('Page:Landon_in_Literary_Gazette_1833.pdf/3'))
# Get the validator of single pageprint(WS.validator('Page:Landon_in_Literary_Gazette_1833.pdf/3'))
Demo 2 (Async bookStatus; Since pywikisource 0.0.4)
frompywikisourceimportWikiSourceApiimportasynciouserAgent="MyCoolTool/1.1 (https://example.org/MyCoolTool/; MyCoolTool@example.org) pywikisource/0.0.4"WS=WikiSourceApi('ta', userAgent) # It is recommended to add user agent.books= [
"தமிழர் வரலாறு 1, பி. டி. சீனிவாச அய்யங்கார்.pdf",
"தமிழர் வரலாறு 2, பி. டி. சீனிவாச அய்யங்கார்.pdf",
"மாவீரர் மருதுபாண்டியர்.pdf",
"சேரன் செங்குட்டுவன்.djvu"
]
forbookinbooks:
pageList=WS.createdPageList( book )
# Default limit is 25 requests per seconddata=asyncio.run( WS.bookStatus( pageList, limit=50 ) )
fortitle, statusindata.items():
print( title, " --> ", status["code"] )