Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from sul-dlss/t9-add-flake8
Adds flake8 and black
- Loading branch information
Showing
7 changed files
with
51 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
#!/usr/bin/python | ||
import os, requests | ||
import logging | ||
import os | ||
import requests | ||
from lxml import etree | ||
from io import BytesIO | ||
|
||
# from sickle import Sickle | ||
# from sickle.iterator import OAIResponseIterator | ||
|
||
|
||
def oai(): | ||
parser = etree.XMLParser(ns_clean=True, load_dtd=False) | ||
xml = requests.get('https://feed.podbean.com/themaghribpodcast/feed.xml').content | ||
xml = requests.get( | ||
"https://feed.podbean.com/themaghribpodcast/feed.xml").content | ||
tree = etree.parse(BytesIO(xml), parser) | ||
directory = "/opt/airflow/output/aims/data/" | ||
os.makedirs(os.path.dirname(directory), exist_ok=True) | ||
|
||
for counter, element in enumerate(tree.findall("//item"), start=1): | ||
with open("{}aims-{}.xml".format(directory, counter), "w") as out_file: | ||
out_file.write(etree.tostring(element, encoding='unicode', pretty_print=True)) | ||
|
||
out_file.write( | ||
etree.tostring(element, encoding="unicode", pretty_print=True) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
#!/usr/bin/python | ||
import os | ||
import time | ||
import shutil | ||
|
||
|
||
def copydir(**kwargs): | ||
src = "/opt/airflow/output/{}".format(kwargs.get('provider')) | ||
src = "/opt/airflow/output/{}".format(kwargs.get("provider")) | ||
dst = "/opt/airflow/output/{}".format(time.time()) | ||
shutil.copytree(src, dst) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
lxml >= 4.6.3 | ||
Sickle >= 0.7.0 | ||
flake8 >= 3.9.2 | ||
black >= 21.7b0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[flake8] | ||
max-line-length = 88 | ||
extend-ignore = E203 |