Skip to content
Merged
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
29 changes: 29 additions & 0 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Pylint

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pylint
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py') --ignore-paths=^tests/.*$ --output=lint_${{ matrix.python-version }}.txt || true
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: lint_${{ matrix.python-version }}.txt
path: lint_${{ matrix.python-version }}.txt
1 change: 1 addition & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[MAIN]
31 changes: 15 additions & 16 deletions console.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
import code
import os
import sys

from dspace_rest_client.client import DSpaceClient
# Import models as needed
#from dspace_rest_client.models import Community, Collection, Item, Bundle, Bitstream
import code
import os

# The DSpace client will look for the same environment variables, but we can also look for them here explicitly
# and as an example
url = 'http://localhost:8080/server/api'
if 'DSPACE_API_ENDPOINT' in os.environ:
url = os.environ['DSPACE_API_ENDPOINT']
username = 'username@test.system.edu'
if 'DSPACE_API_USERNAME' in os.environ:
username = os.environ['DSPACE_API_USERNAME']
password = 'password'
if 'DSPACE_API_PASSWORD' in os.environ:
password = os.environ['DSPACE_API_PASSWORD']
DEFAULT_URL = 'http://localhost:8080/server/api'
DEFAULT_USERNAME = 'username@test.system.edu'
DEFAULT_PASSWORD = 'password'

# Configuration from environment variables
URL = os.environ.get('DSPACE_API_ENDPOINT', DEFAULT_URL)
USERNAME = os.environ.get('DSPACE_API_USERNAME', DEFAULT_USERNAME)
PASSWORD = os.environ.get('DSPACE_API_PASSWORD', DEFAULT_PASSWORD)

# Instantiate DSpace client
d = DSpaceClient(api_endpoint=url, username=username, password=password)
d = DSpaceClient(api_endpoint=URL, username=USERNAME, password=PASSWORD)

# Authenticate against the DSpace client
authenticated = d.authenticate()
if not authenticated:
print(f'Error logging in! Giving up.')
exit(1)
print('Error logging in! Giving up.')
sys.exit(1)

code.interact(local=locals())
Loading