Skip to content

Commit

Permalink
Cleanup (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggravlingen authored Mar 15, 2022
1 parent 048e0f5 commit f39eeb7
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 61 deletions.
2 changes: 0 additions & 2 deletions .hound.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

29 changes: 16 additions & 13 deletions examples/example_download_parse_xml.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
# Hack to allow relative import above top level package
import sys
import os
import sys

folder = os.path.dirname(os.path.abspath(__file__)) # noqa
sys.path.insert(0, os.path.normpath("%s/.." % folder)) # noqa

from pygleif.const import URL_LEVEL2_CONCAT_FILES
from pygleif import GLEIFParseRelationshipRecord
import arrow
import wget
from zipfile import ZipFile
import os
import xml.etree.ElementTree as ET
from zipfile import ZipFile

import arrow
import wget

from pygleif import GLEIFParseRelationshipRecord
from pygleif.const import URL_LEVEL2_CONCAT_FILES

debug = 1

today = arrow.now().format('YYYYMMDD')
level_2_url = URL_LEVEL2_CONCAT_FILES.replace('%date%', today)
save_name = 'file'+today+'.zip'
extracted_file = today+'-gleif-concatenated-file-rr.xml'
today = arrow.now().format("YYYYMMDD")
level_2_url = URL_LEVEL2_CONCAT_FILES.replace("%date%", today)
save_name = "file" + today + ".zip"
extracted_file = today + "-gleif-concatenated-file-rr.xml"

if debug == 0:

Expand All @@ -28,8 +31,8 @@
wget.download(level_2_url, save_name)

# opening the zip file in READ mode
with ZipFile(save_name, 'r') as zip:
print('Extracting all the files now...')
with ZipFile(save_name, "r") as zip:
print("Extracting all the files now...")
zip.extractall()
os.remove(save_name)

Expand All @@ -38,7 +41,7 @@

# for i in range(len(root[1])):
for i in range(5):
xml_data = ET.tostring(root[1][i], encoding='utf8', method='xml')
xml_data = ET.tostring(root[1][i], encoding="utf8", method="xml")
data = GLEIFParseRelationshipRecord(xml_data)

relationship_type = data.raw.Relationship.RelationshipType.text
Expand Down
10 changes: 6 additions & 4 deletions examples/query_api.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# Hack to allow relative import above top level package
import sys
import os
import sys

folder = os.path.dirname(os.path.abspath(__file__)) # noqa
sys.path.insert(0, os.path.normpath("%s/.." % folder)) # noqa
from pprint import pprint
from pygleif.gleif import GLEIF

from pygleif import Search
from pygleif.gleif import GLEIF

gleif_data = GLEIF('506700GE1G29325QX363')
gleif_search = Search('986228608')
gleif_data = GLEIF("506700GE1G29325QX363")
gleif_search = Search("986228608")


pprint((gleif_data.raw))
Expand Down
33 changes: 16 additions & 17 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from setuptools import setup, find_packages

# To use a consistent encoding
from codecs import open
from os import path

from setuptools import find_packages, setup

here = path.abspath(path.dirname(__file__))

# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()

VERSION = "2.0.0"
DOWNLOAD_URL = \
'https://github.com/ggravlingen/pygleif/archive/{}.zip'.format(VERSION)
VERSION = "3.0.0"
DOWNLOAD_URL = 'https://github.com/ggravlingen/pygleif/archive/{}.zip'.format(VERSION)

PACKAGES = find_packages(exclude=['tests', 'tests.*'])

setup(
name='pygleif',
packages=PACKAGES,
python_requires='>=3.8',
version=VERSION,
description='API for LEI',
long_description=long_description,
author='ggravlingen',
author_email='no@email.com',
url='https://github.com/ggravlingen/pygleif',
license='MIT',
keywords='lei-code lei api gleif leicode',
download_url=DOWNLOAD_URL
name='pygleif',
packages=PACKAGES,
python_requires='>=3.8',
version=VERSION,
description='API for LEI',
long_description=long_description,
author='ggravlingen',
author_email='no@email.com',
url='https://github.com/ggravlingen/pygleif',
license='MIT',
keywords='lei-code lei api gleif leicode',
download_url=DOWNLOAD_URL,
)

0 comments on commit f39eeb7

Please sign in to comment.