Use proper attributes for xml:lang.

This commit is contained in:
Elliott Pardee 2018-08-24 05:47:53 -04:00
parent 7b735727f4
commit 358c9bc2d6
6 changed files with 70 additions and 35 deletions

93
.idea/workspace.xml generated
View File

@ -3,7 +3,9 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="c8edefbc-71df-41a9-9878-b830c52cd7b5" name="Default Changelist" comment=""> <list default="true" id="c8edefbc-71df-41a9-9878-b830c52cd7b5" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/goarch_api/client.py" beforeDir="false" afterPath="$PROJECT_DIR$/goarch_api/client.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/goarch_api/client.py" beforeDir="false" afterPath="$PROJECT_DIR$/goarch_api/client.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/goarch_api/daily.py" beforeDir="false" afterPath="$PROJECT_DIR$/goarch_api/daily.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/goarch_api/lectionary.py" beforeDir="false" afterPath="$PROJECT_DIR$/goarch_api/lectionary.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/goarch_api/lectionary.py" beforeDir="false" afterPath="$PROJECT_DIR$/goarch_api/lectionary.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/goarch_api/saint.py" beforeDir="false" afterPath="$PROJECT_DIR$/goarch_api/saint.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/setup.py" beforeDir="false" afterPath="$PROJECT_DIR$/setup.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/setup.py" beforeDir="false" afterPath="$PROJECT_DIR$/setup.py" afterDir="false" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@ -45,7 +47,7 @@
<entry key="dummy" value="14" /> <entry key="dummy" value="14" />
<entry key="gitignore" value="1" /> <entry key="gitignore" value="1" />
<entry key="md" value="690" /> <entry key="md" value="690" />
<entry key="py" value="11785" /> <entry key="py" value="11943" />
<entry key="txt" value="122" /> <entry key="txt" value="122" />
</counts> </counts>
</usages-collector> </usages-collector>
@ -53,7 +55,7 @@
<counts> <counts>
<entry key="Markdown" value="690" /> <entry key="Markdown" value="690" />
<entry key="PLAIN_TEXT" value="137" /> <entry key="PLAIN_TEXT" value="137" />
<entry key="Python" value="11847" /> <entry key="Python" value="12005" />
</counts> </counts>
</usages-collector> </usages-collector>
</session> </session>
@ -114,8 +116,8 @@
<caret line="8" column="79" selection-start-line="8" selection-start-column="79" selection-end-line="8" selection-end-column="79" /> <caret line="8" column="79" selection-start-line="8" selection-start-column="79" selection-end-line="8" selection-end-column="79" />
<folding> <folding>
<element signature="e#0#15#0" expanded="true" /> <element signature="e#0#15#0" expanded="true" />
<marker date="1535103697226" expanded="true" signature="46:47" ph="..." /> <marker date="1535104046164" expanded="true" signature="46:47" ph="..." />
<marker date="1535103697226" expanded="true" signature="46:51" ph="..." /> <marker date="1535104046164" expanded="true" signature="46:51" ph="..." />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -128,8 +130,8 @@
<caret line="62" column="51" selection-start-line="62" selection-start-column="51" selection-end-line="62" selection-end-column="51" /> <caret line="62" column="51" selection-start-line="62" selection-start-column="51" selection-end-line="62" selection-end-column="51" />
<folding> <folding>
<element signature="e#0#22#0" expanded="true" /> <element signature="e#0#22#0" expanded="true" />
<marker date="1535039127435" expanded="true" signature="165:170" ph="..." /> <marker date="1535104025467" expanded="true" signature="165:170" ph="..." />
<marker date="1535039127435" expanded="true" signature="200:438" ph="..." /> <marker date="1535104025467" expanded="true" signature="200:438" ph="..." />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -147,8 +149,11 @@
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/goarch_api/saint.py"> <entry file="file://$PROJECT_DIR$/goarch_api/saint.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="138"> <state relative-caret-position="-561">
<caret line="6" column="54" selection-start-line="6" selection-start-column="54" selection-end-line="6" selection-end-column="54" /> <caret line="55" lean-forward="true" selection-start-line="55" selection-end-line="55" />
<folding>
<element signature="e#0#9#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
@ -156,11 +161,11 @@
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/goarch_api/lectionary.py"> <entry file="file://$PROJECT_DIR$/goarch_api/lectionary.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1163"> <state relative-caret-position="197">
<caret line="57" lean-forward="true" selection-start-line="57" selection-end-line="57" /> <caret line="73" lean-forward="true" selection-start-line="73" selection-end-line="73" />
<folding> <folding>
<element signature="e#0#9#0" expanded="true" /> <element signature="e#0#9#0" expanded="true" />
<marker date="1535103677328" expanded="true" signature="246:249" ph="..." /> <marker date="1535104035875" expanded="true" signature="246:249" ph="..." />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -178,7 +183,11 @@
<component name="FindInProjectRecents"> <component name="FindInProjectRecents">
<findStrings> <findStrings>
<find>translation</find> <find>translation</find>
<find>xml:lang</find>
</findStrings> </findStrings>
<replaceStrings>
<replace>{http://www.w3.org/XML/1998/namespace}lang</replace>
</replaceStrings>
</component> </component>
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
@ -203,9 +212,9 @@
<option value="$PROJECT_DIR$/goarch_api/daily.py" /> <option value="$PROJECT_DIR$/goarch_api/daily.py" />
<option value="$PROJECT_DIR$/goarch_api/models.py" /> <option value="$PROJECT_DIR$/goarch_api/models.py" />
<option value="$PROJECT_DIR$/goarch_api/saint.py" /> <option value="$PROJECT_DIR$/goarch_api/saint.py" />
<option value="$PROJECT_DIR$/setup.py" />
<option value="$PROJECT_DIR$/goarch_api/lectionary.py" /> <option value="$PROJECT_DIR$/goarch_api/lectionary.py" />
<option value="$PROJECT_DIR$/goarch_api/client.py" /> <option value="$PROJECT_DIR$/goarch_api/client.py" />
<option value="$PROJECT_DIR$/setup.py" />
</list> </list>
</option> </option>
</component> </component>
@ -263,7 +272,7 @@
</list> </list>
</option> </option>
</component> </component>
<component name="RunManager" selected="Python.lectionary"> <component name="RunManager" selected="Python.lectionary (1)">
<configuration name="daily" type="PythonConfigurationType" factoryName="Python" temporary="true"> <configuration name="daily" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="goarch_api" /> <module name="goarch_api" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
@ -285,6 +294,27 @@
<option name="INPUT_FILE" value="" /> <option name="INPUT_FILE" value="" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
<configuration name="lectionary (1)" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="goarch_api" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/goarch_api" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/goarch_api/lectionary.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="lectionary" type="PythonConfigurationType" factoryName="Python" temporary="true"> <configuration name="lectionary" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="goarch_api" /> <module name="goarch_api" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
@ -331,9 +361,11 @@
<item itemvalue="Python.reading" /> <item itemvalue="Python.reading" />
<item itemvalue="Python.daily" /> <item itemvalue="Python.daily" />
<item itemvalue="Python.lectionary" /> <item itemvalue="Python.lectionary" />
<item itemvalue="Python.lectionary (1)" />
</list> </list>
<recent_temporary> <recent_temporary>
<list> <list>
<item itemvalue="Python.lectionary (1)" />
<item itemvalue="Python.lectionary" /> <item itemvalue="Python.lectionary" />
<item itemvalue="Python.daily" /> <item itemvalue="Python.daily" />
<item itemvalue="Python.reading" /> <item itemvalue="Python.reading" />
@ -371,7 +403,7 @@
<window_info id="Favorites" order="2" sideWeight="0.18271606" side_tool="true" weight="0.24980605" /> <window_info id="Favorites" order="2" sideWeight="0.18271606" side_tool="true" weight="0.24980605" />
<window_info anchor="bottom" id="Message" order="0" /> <window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" /> <window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Run" order="2" weight="0.3294702" /> <window_info anchor="bottom" id="Run" order="2" weight="0.32890365" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.39900663" /> <window_info anchor="bottom" id="Debug" order="3" weight="0.39900663" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
@ -430,8 +462,8 @@
<caret line="62" column="51" selection-start-line="62" selection-start-column="51" selection-end-line="62" selection-end-column="51" /> <caret line="62" column="51" selection-start-line="62" selection-start-column="51" selection-end-line="62" selection-end-column="51" />
<folding> <folding>
<element signature="e#0#22#0" expanded="true" /> <element signature="e#0#22#0" expanded="true" />
<marker date="1535039127435" expanded="true" signature="165:170" ph="..." /> <marker date="1535104025467" expanded="true" signature="165:170" ph="..." />
<marker date="1535039127435" expanded="true" signature="200:438" ph="..." /> <marker date="1535104025467" expanded="true" signature="200:438" ph="..." />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -443,13 +475,23 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/goarch_api/lectionary.py"> <entry file="file://$PROJECT_DIR$/goarch_api/saint.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1163"> <state relative-caret-position="-561">
<caret line="57" lean-forward="true" selection-start-line="57" selection-end-line="57" /> <caret line="55" lean-forward="true" selection-start-line="55" selection-end-line="55" />
<folding> <folding>
<element signature="e#0#9#0" expanded="true" /> <element signature="e#0#9#0" expanded="true" />
<marker date="1535103677328" expanded="true" signature="246:249" ph="..." /> </folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/goarch_api/lectionary.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="197">
<caret line="73" lean-forward="true" selection-start-line="73" selection-end-line="73" />
<folding>
<element signature="e#0#9#0" expanded="true" />
<marker date="1535104035875" expanded="true" signature="246:249" ph="..." />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -460,19 +502,12 @@
<caret line="8" column="79" selection-start-line="8" selection-start-column="79" selection-end-line="8" selection-end-column="79" /> <caret line="8" column="79" selection-start-line="8" selection-start-column="79" selection-end-line="8" selection-end-column="79" />
<folding> <folding>
<element signature="e#0#15#0" expanded="true" /> <element signature="e#0#15#0" expanded="true" />
<marker date="1535103697226" expanded="true" signature="46:47" ph="..." /> <marker date="1535104046164" expanded="true" signature="46:47" ph="..." />
<marker date="1535103697226" expanded="true" signature="46:51" ph="..." /> <marker date="1535104046164" expanded="true" signature="46:51" ph="..." />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/goarch_api/saint.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="138">
<caret line="6" column="54" selection-start-line="6" selection-start-column="54" selection-end-line="6" selection-end-column="54" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/setup.py"> <entry file="file://$PROJECT_DIR$/setup.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="92"> <state relative-caret-position="92">

View File

@ -6,7 +6,7 @@ class HTTPClient:
def __init__(self): def __init__(self):
self.session = requests.session() self.session = requests.session()
user_agent = 'goarch_api (https://github.com/Oikonomia/goarch_api 1.0.7), Python/' user_agent = 'goarch_api (https://github.com/Oikonomia/goarch_api 1.0.8), Python/'
self.user_agent = f"{user_agent}{sys.version_info[0]}.{sys.version_info[1]}" self.user_agent = f"{user_agent}{sys.version_info[0]}.{sys.version_info[1]}"
def request(self, method, path): def request(self, method, path):

View File

@ -39,7 +39,7 @@ class Daily:
event = reading.find("event").text event = reading.find("event").text
translation = reading.find("translation") translation = reading.find("translation")
t_lang = translation.get("xml:lang") t_lang = translation.get("{http://www.w3.org/XML/1998/namespace}lang")
t_title = translation.find("title").text t_title = translation.find("title").text
t_short_title = translation.find("shorttitle").text t_short_title = translation.find("shorttitle").text

View File

@ -48,7 +48,7 @@ class Lectionary:
self.translations = [] self.translations = []
for translation in tree.findall("translation"): for translation in tree.findall("translation"):
lang = translation.get("xml:lang") lang = translation.get("{http://www.w3.org/XML/1998/namespace}lang")
if lang != "ar": # because arabic and the html escape stuff doesn't really work if lang != "ar": # because arabic and the html escape stuff doesn't really work
title = translation.find("title").text title = translation.find("title").text

View File

@ -57,7 +57,7 @@ class Saint:
self.readings = [] self.readings = []
for reading in tree.find("readings").iterchildren(): for reading in tree.find("readings").iterchildren():
lang = reading.get("xml:lang") lang = reading.get("{http://www.w3.org/XML/1998/namespace}lang")
title = reading.find("title").text title = reading.find("title").text
short_title = reading.find("shorttitle").text short_title = reading.find("shorttitle").text
body = remove_html_tags(reading.find("body").text).strip() body = remove_html_tags(reading.find("body").text).strip()
@ -77,7 +77,7 @@ class Saint:
tone = hymn.find("tone").text tone = hymn.find("tone").text
translation = hymn.find("translation") translation = hymn.find("translation")
t_lang = translation.get("xml:lang") t_lang = translation.get("{http://www.w3.org/XML/1998/namespace}lang")
t_body = translation.find("body").text t_body = translation.find("body").text
t_copyright = translation.find("copyright").text t_copyright = translation.find("copyright").text

View File

@ -2,7 +2,7 @@ from setuptools import setup
setup( setup(
name="goarch_api", name="goarch_api",
version="1.0.7", version="1.0.8",
author="Elliott Pardee", author="Elliott Pardee",
author_email="me@vypr.xyz", author_email="me@vypr.xyz",
url="https://github.com/Oikonomia/goarch_api", url="https://github.com/Oikonomia/goarch_api",