<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://charlesreid1.com/w/index.php?action=history&amp;feed=atom&amp;title=Pywikibot%2FConfiguring</id>
	<title>Pywikibot/Configuring - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://charlesreid1.com/w/index.php?action=history&amp;feed=atom&amp;title=Pywikibot%2FConfiguring"/>
	<link rel="alternate" type="text/html" href="https://charlesreid1.com/w/index.php?title=Pywikibot/Configuring&amp;action=history"/>
	<updated>2026-06-19T15:46:19Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.12</generator>
	<entry>
		<id>https://charlesreid1.com/w/index.php?title=Pywikibot/Configuring&amp;diff=29544&amp;oldid=prev</id>
		<title>Unknown user: Created page with &quot;Covers how to configure Pywikibot to talk to third-party wiki sites.  ==Directory Structure==  The directory structure for your pywikibot script should be a top-level dire...&quot;</title>
		<link rel="alternate" type="text/html" href="https://charlesreid1.com/w/index.php?title=Pywikibot/Configuring&amp;diff=29544&amp;oldid=prev"/>
		<updated>2022-05-27T02:21:11Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Covers how to configure &lt;a href=&quot;/wiki/Pywikibot&quot; title=&quot;Pywikibot&quot;&gt;Pywikibot&lt;/a&gt; to talk to third-party wiki sites.  ==Directory Structure==  The directory structure for your pywikibot script should be a top-level dire...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Covers how to configure [[Pywikibot]] to talk to third-party wiki sites.&lt;br /&gt;
&lt;br /&gt;
==Directory Structure==&lt;br /&gt;
&lt;br /&gt;
The directory structure for your pywikibot script should be a top-level directory containing your pywikibot script, and a copy of the pywikibot repository.&lt;br /&gt;
&lt;br /&gt;
For example, a bot named &amp;lt;code&amp;gt;my_bot&amp;lt;/code&amp;gt; would be set up as follows (note that &amp;lt;code&amp;gt;core_stable&amp;lt;/code&amp;gt; is a copy of the pywikibot core repository):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
my_bot/&lt;br /&gt;
    my_bot_script.py&lt;br /&gt;
    user-config.py&lt;br /&gt;
    core_stable/&lt;br /&gt;
        pwb.py&lt;br /&gt;
        generate_*.py&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
IMPORTANT:&lt;br /&gt;
&lt;br /&gt;
When running scripts like &amp;lt;code&amp;gt;my_bot_script.py&amp;lt;/code&amp;gt;, run them from the &amp;lt;code&amp;gt;my_bot/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
When generating configuration files or setting up the wiki login credentials, run scripts from the &amp;lt;code&amp;gt;core_stable/&amp;lt;/code&amp;gt; pywikibot repo directory.&lt;br /&gt;
&lt;br /&gt;
==Create MediaWiki Bot User==&lt;br /&gt;
&lt;br /&gt;
You will need to create credentials that the bot can use to make edits. &lt;br /&gt;
&lt;br /&gt;
Go to [[Special:BotPasswords]] to create a bot password.&lt;br /&gt;
&lt;br /&gt;
MediaWiki Documentation: https://www.mediawiki.org/wiki/Manual:Pywikibot/BotPasswords&lt;br /&gt;
&lt;br /&gt;
==Create Family File==&lt;br /&gt;
&lt;br /&gt;
In order to run [[Pywikibot]] on a third-party wiki, you have to tell your wiki how to interact with the third-party wiki. To do that, you need a family file.&lt;br /&gt;
&lt;br /&gt;
Family files can be generated using the &amp;lt;code&amp;gt;generate_family_file.py&amp;lt;/code&amp;gt; script. Run the script from the &amp;lt;code&amp;gt;core_stable/&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
py generate_family_file.py&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will write a family file in &amp;lt;code&amp;gt;my_bot/core_stable/pywikibot/families&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Writing /path/to/my_bot/core_stable/pywikibot/families/mythirdpartywiki_family.py...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set Up Login Credentials==&lt;br /&gt;
&lt;br /&gt;
Next step is to store credentials for the bot account we created.&lt;br /&gt;
&lt;br /&gt;
Go to the &amp;lt;code&amp;gt;core_stable/&amp;lt;/code&amp;gt; directory and use the &amp;lt;code&amp;gt;generate_user_files.py&amp;lt;/code&amp;gt; script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
py generate_user_files.py&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will prompt for credentials, then generate some files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
BotPassword&amp;#039;s &amp;quot;bot name&amp;quot; for Ch4zm: Ch4zmBat&lt;br /&gt;
BotPassword&amp;#039;s &amp;quot;password&amp;quot; for &amp;quot;Ch4zmBat&amp;quot; (no characters will be shown):&lt;br /&gt;
&amp;#039;/Users/charles/golly/wiki-article-generator/bot/core_stable/user-config.py&amp;#039; written.&lt;br /&gt;
&amp;#039;/Users/charles/golly/wiki-article-generator/bot/core_stable/user-password.py&amp;#039; written.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Use Credentials to Log In==&lt;br /&gt;
&lt;br /&gt;
Now that we have stored the credentials, use them to log in and set up a bot session that pywikibot can use.&lt;br /&gt;
&lt;br /&gt;
Go to &amp;lt;code&amp;gt;core_stable/&amp;lt;/code&amp;gt; directory and use the provided login script to log in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ py pwb.py scripts/login.py&lt;br /&gt;
WARNING: No user is logged in on site gollywiki:en&lt;br /&gt;
Logging in to gollywiki:en as Ch4zm@Ch4zmBat&lt;br /&gt;
Logged in on gollywiki:en as Ch4zm.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Where Credentials Are Stored==&lt;br /&gt;
&lt;br /&gt;
The [[#Set Up Login Credentials]] step prompted for MediaWiki bot credentials. Those credentials are stored in the file &amp;lt;code&amp;gt;user-password.py&amp;lt;/code&amp;gt; in the pywikibot repository directory.&lt;br /&gt;
&lt;br /&gt;
The contents of the file look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat orig_core_stable/user-password.py&lt;br /&gt;
# This is an automatically generated file used to store&lt;br /&gt;
# BotPasswords.&lt;br /&gt;
#&lt;br /&gt;
# As a simpler (but less secure) alternative to OAuth, MediaWiki allows bot&lt;br /&gt;
# users to uses BotPasswords to limit the permissions given to a bot.&lt;br /&gt;
# When using BotPasswords, each instance gets keys. This combination can only&lt;br /&gt;
# access the API, not the normal web interface.&lt;br /&gt;
#&lt;br /&gt;
# See https://www.mediawiki.org/wiki/Manual:Pywikibot/BotPasswords for more&lt;br /&gt;
# information.&lt;br /&gt;
(&amp;#039;YourUserAccount&amp;#039;, BotPassword(&amp;#039;YourBotAccount&amp;#039;, &amp;#039;bot_password&amp;#039;))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is also an auto-generated &amp;lt;code&amp;gt;user-config.py&amp;lt;/code&amp;gt; file that stores configuration details for the wiki.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{PywikibotFlag}}&lt;/div&gt;</summary>
		<author><name>Unknown user</name></author>
	</entry>
</feed>