Difference between revisions of "User:Ch4zm/Pywikibot"

From Golly.Life Wiki
 
(3 intermediate revisions by the same user not shown)
Line 15: Line 15:
 
* Another example, how to connect the objects to a given page? Like, I can extract Category objects that tell me about categories on a page, but how do I update a section that may contain Categories, and preserve the Category links and only the category links? or the templates?
 
* Another example, how to connect the objects to a given page? Like, I can extract Category objects that tell me about categories on a page, but how do I update a section that may contain Categories, and preserve the Category links and only the category links? or the templates?
 
* Why is this so difficult?
 
* Why is this so difficult?
 +
 +
Solution to make this all simpler:
 +
 +
* pywikibot is limited, capabilities-wise, by its crummy incomplete barely-sufficient documentation.
 +
* we have to do what we have to do, make it work using whatever capabilities it does have. work around that.
 +
* meaning, if we expect Records pages to be automatically updated, then structure them so it makes it really easy to parse the page.
 +
 +
[[:Category:Records]]

Latest revision as of 22:52, 4 October 2021

Notes

20211004

Questions about Pywikibot:

  • Digging into the example, there's this textlib.extract_sections, but it's not documented as part of the API. What gives?
  • Once you extract a document into its corresponding sections, you can pick out a specific section. But what then?
  • You can't (apparently) modify the Section object.
  • You can't create your own Section, because it's a private object, not documented, not part of public API.
  • So, we end up looping over each section, and finding section.title + section.content unless it's the section we want.
  • This seems really idiotic, but there's no documentation of any of these functions or objects, sooooo what the fuck am I supposed to do?
  • I'm getting stuck on the very first non-trivial task I have, the very first non-trivial article I'm editing.
  • All kinds of mysterious stuff going on in the pywikibot library that isn't documented. WTF??
  • Another example, how to connect the objects to a given page? Like, I can extract Category objects that tell me about categories on a page, but how do I update a section that may contain Categories, and preserve the Category links and only the category links? or the templates?
  • Why is this so difficult?

Solution to make this all simpler:

  • pywikibot is limited, capabilities-wise, by its crummy incomplete barely-sufficient documentation.
  • we have to do what we have to do, make it work using whatever capabilities it does have. work around that.
  • meaning, if we expect Records pages to be automatically updated, then structure them so it makes it really easy to parse the page.

Category:Records