<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AFormat_ISBN%2Fdata%2Fdoc</id>
	<title>Module:Format ISBN/data/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AFormat_ISBN%2Fdata%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:Format_ISBN/data/doc&amp;action=history"/>
	<updated>2026-06-14T11:45:32Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.3</generator>
	<entry>
		<id>https://mywikibiz.com/index.php?title=Module:Format_ISBN/data/doc&amp;diff=471782&amp;oldid=prev</id>
		<title>Zoran: Pywikibot 6.4.0</title>
		<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:Format_ISBN/data/doc&amp;diff=471782&amp;oldid=prev"/>
		<updated>2021-07-15T21:46:47Z</updated>

		<summary type="html">&lt;p&gt;Pywikibot 6.4.0&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{collapse top|title=Python script to update this data module}}&lt;br /&gt;
{{scroll|1=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/bin/env python&lt;br /&gt;
&lt;br /&gt;
# This work has been released into the public domain by its author, User:Cobaltcigs.&lt;br /&gt;
# This applies worldwide.  In some countries this may not be legally possible; if so:&lt;br /&gt;
# User:Cobaltcigs grants anyone the right to use this work for any purpose, without any&lt;br /&gt;
# conditions, unless such conditions are required by law.&lt;br /&gt;
&lt;br /&gt;
import xml.dom.minidom&lt;br /&gt;
import urllib2&lt;br /&gt;
&lt;br /&gt;
url = &amp;quot;https://www.isbn-international.org/export_rangemessage.xml&amp;quot;&lt;br /&gt;
req = urllib2.Request(url)&lt;br /&gt;
response = urllib2.urlopen(req)&lt;br /&gt;
xmlTxt = response.read()&lt;br /&gt;
&lt;br /&gt;
f = open(&amp;quot;RangeMessage.xml&amp;quot;, &amp;quot;w&amp;quot;)&lt;br /&gt;
f.write(xmlTxt)&lt;br /&gt;
f.close()&lt;br /&gt;
&lt;br /&gt;
document = xml.dom.minidom.parseString(xmlTxt)&lt;br /&gt;
&lt;br /&gt;
source = document.getElementsByTagName(&amp;quot;MessageSource&amp;quot;)[0].firstChild.nodeValue&lt;br /&gt;
version = document.getElementsByTagName(&amp;quot;MessageSerialNumber&amp;quot;)[0].firstChild.nodeValue&lt;br /&gt;
timestamp = document.getElementsByTagName(&amp;quot;MessageDate&amp;quot;)[0].firstChild.nodeValue&lt;br /&gt;
&lt;br /&gt;
print(&amp;quot;--[[&amp;quot;)&lt;br /&gt;
print(&amp;quot;&amp;quot;&amp;quot;\tGenerated from %s's RangeMessage.xml file at:&lt;br /&gt;
\t\t%s&lt;br /&gt;
\tusing a script.&lt;br /&gt;
\tVersion: %s (%s)&amp;quot;&amp;quot;&amp;quot; % (source, url, version, timestamp))&lt;br /&gt;
print(&amp;quot;&amp;quot;&amp;quot;\tNotes:&lt;br /&gt;
\t* Integer tuples at right represent the middle three (of five) digit-group quantities&lt;br /&gt;
\t  for any ISBN in the specified (quasi-numeric but actually lexicographical) range.&lt;br /&gt;
\t* The &amp;quot;specified range&amp;quot; for the tuple specified on row[N] can be thought of as any&lt;br /&gt;
\t  ISBN Q where (Q &amp;lt;= row[N].isbn) &amp;amp;&amp;amp; (Q &amp;gt; (row[n-1].isbn or 0))&lt;br /&gt;
\t* Omitted for brevity are the first group (&amp;quot;978&amp;quot;/&amp;quot;979&amp;quot;, always 3) and the last group&lt;br /&gt;
\t  (check digit, always 1).&lt;br /&gt;
\t* In other words, an ISBN whose digit grouping is specified below as {x,y,z} will match&lt;br /&gt;
\t  the regular expression &amp;quot;^\d{3}\-\d{x}\-\d{y}\-\d{z}\-\d{1}$&amp;quot; once properly formatted.&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;)&lt;br /&gt;
print(&amp;quot;--]]&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
print(&amp;quot;return {&amp;quot;)&lt;br /&gt;
for p in document.getElementsByTagName(&amp;quot;Prefix&amp;quot;):&lt;br /&gt;
	pp = p.firstChild.nodeValue.split(&amp;quot;-&amp;quot;)&lt;br /&gt;
	if len(pp) != 2: continue&lt;br /&gt;
	prefix = &amp;quot;&amp;quot;.join(pp)&lt;br /&gt;
	n1 = len(pp[0])&lt;br /&gt;
	n2 = len(pp[1]) &lt;br /&gt;
	for q in p.parentNode.getElementsByTagName(&amp;quot;Rule&amp;quot;):&lt;br /&gt;
		end = (prefix + q.getElementsByTagName(&amp;quot;Range&amp;quot;)[0].firstChild.nodeValue.split(&amp;quot;-&amp;quot;)[1]+&amp;quot;9&amp;quot;*9)[:13]&lt;br /&gt;
		n3 = int(q.getElementsByTagName(&amp;quot;Length&amp;quot;)[0].firstChild.nodeValue)&lt;br /&gt;
		# disregard (yet unallocated?) blocks where (publisher identifier's) &amp;lt;Length&amp;gt;0&amp;lt;/Length&amp;gt;&lt;br /&gt;
		if n3 == 0: continue &lt;br /&gt;
		n4 = 12-(n1+n2+n3)&lt;br /&gt;
		# check digit length not mathematically needed here&lt;br /&gt;
#		n5 = 1&lt;br /&gt;
		print('\t{&amp;quot;%s&amp;quot;, {%s,%s,%s}},' % (end,n2,n3,n4))&lt;br /&gt;
print(&amp;quot;\t}&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
{{collapse bottom}}&lt;/div&gt;</summary>
		<author><name>Zoran</name></author>
	</entry>
</feed>