Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package

on:
release:
types: [created]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
2 changes: 2 additions & 0 deletions bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"%PYTHON%" setup.py install
if errorlevel 1 exit 1
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$PYTHON setup.py install # Python command to install the script.
36 changes: 36 additions & 0 deletions elsapy/elssource.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from abc import ABCMeta, abstractmethod
from .elsentity import ElsEntity

class ElsSource(ElsEntity):
"""An serial in Scopus. Initialize with URI or source ISSN."""

# static variables
_payload_type = 'serial-metadata-response'
_uri_base = u'https://api.elsevier.com/content/serial/title/issn/'

# constructors
def __init__(self, uri = '', serial_issn = ''):
"""Initializes a serial given a Scopus source URI or serial ISSN"""
if uri and not serial_issn:
super().__init__(uri)
elif serial_issn and not uri:
super().__init__(self._uri_base + str(serial_issn))
elif not uri and not serial_issn:
raise ValueError('No URI or ISSN specified')
else:
raise ValueError('Both URI and ISSN specified; just need one.')

# properties
@property
def title(self):
"""Gets the serial's title"""
return self.data[u'entry'][0][u'dc:title']

# modifier functions
def read(self, els_client = None):
"""Reads the JSON representation of the author from ELSAPI.
Returns True if successful; else, False."""
if ElsEntity.read(self, self._payload_type, els_client):
return True
else:
return False
26 changes: 26 additions & 0 deletions meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
source:
git_tag: v0.5.2
git_url: "https://github.com/james-geiger/elsapy.git"

package:
name: elsapy
version: {{ environ['GIT_DESCRIBE_TAG'] }}

build:
number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
string: {{ environ.get('GIT_BUILD_STR', '') }}

requirements:
build:
- python
- setuptools
- requests
- pandas

run:
- python
- requests
- pandas

about:
home: "https://github.com/james-geiger/elsapy/tree/conda"
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
'Programming Language :: Python :: 3',
],
packages = find_packages(exclude=['contrib', 'docs', 'tests*']),
install_requires = ['requests']
install_requires = ['requests', 'pandas']
)