Skip to content

Commit

Permalink
Clean up imports.
Browse files Browse the repository at this point in the history
  • Loading branch information
ale-de-vries committed Sep 6, 2017
1 parent e41c50e commit 07acb2c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 23 deletions.
2 changes: 2 additions & 0 deletions elsapy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
* https://github.com/ElsevierDev/elsapy
* https://dev.elsevier.com
* https://api.elsevier.com"""

version = '0.4.2'
18 changes: 10 additions & 8 deletions elsapy/elsclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
* https://api.elsevier.com"""


import requests, json, time, urllib
from pathlib import Path
import requests, json, time
from . import log_util

__version__ = '0.4.1'
from .__init__ import version
try:
import pathlib
except ImportError:
import pathlib2 as pathlib

logger = log_util.get_logger(__name__)

Expand All @@ -18,7 +20,7 @@ class ElsClient:

# class variables
__url_base = "https://api.elsevier.com/" ## Base URL for later use
__user_agent = "elsapy-v%s" % __version__ ## Helps track library use
__user_agent = "elsapy-v%s" % version ## Helps track library use
__min_req_interval = 1 ## Min. request interval in sec
__ts_last_req = time.time() ## Tracker for throttling

Expand All @@ -30,9 +32,9 @@ def __init__(self, api_key, inst_token = None, num_res = 25, local_dir = None):
self.inst_token = inst_token
self.num_res = num_res
if not local_dir:
self.local_dir = Path.cwd() / 'data'
self.local_dir = pathlib.Path.cwd() / 'data'
else:
self.local_dir = Path(local_dir)
self.local_dir = pathlib.Path(local_dir)
if not self.local_dir.exists():
self.local_dir.mkdir()

Expand Down Expand Up @@ -78,7 +80,7 @@ def req_status(self):
@local_dir.setter
def local_dir(self, path_str):
"""Sets the local path to write data to."""
self._local_dir = Path(path_str)
self._local_dir = pathlib.Path(path_str)

# access functions
def getBaseURL(self):
Expand Down
5 changes: 0 additions & 5 deletions elsapy/elsdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
* https://dev.elsevier.com
* https://api.elsevier.com"""


import requests, json, urllib
from abc import ABCMeta, abstractmethod
from pathlib import Path
from . import log_util
from .elsclient import ElsClient
from .elsentity import ElsEntity

logger = log_util.get_logger(__name__)
Expand Down
5 changes: 1 addition & 4 deletions elsapy/elsentity.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
* https://dev.elsevier.com
* https://api.elsevier.com"""

__version__ = '0.2'

import requests, json, logging, urllib
import requests, json, urllib
from abc import ABCMeta, abstractmethod
from pathlib import Path
from . import log_util

logger = log_util.get_logger(__name__)
Expand Down
2 changes: 0 additions & 2 deletions elsapy/elsprofile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@

import requests, json, urllib
from abc import ABCMeta, abstractmethod
from pathlib import Path
from . import log_util
from .elsclient import ElsClient
from .elsentity import ElsEntity

logger = log_util.get_logger(__name__)
Expand Down
4 changes: 0 additions & 4 deletions elsapy/elssearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
* https://dev.elsevier.com
* https://api.elsevier.com"""

import requests, json, urllib
from abc import ABCMeta, abstractmethod
from pathlib import Path
from . import log_util
from .elsclient import ElsClient

logger = log_util.get_logger(__name__)

Expand Down

0 comments on commit 07acb2c

Please sign in to comment.