From 499c5008a2dd6c9cd441280578af5b6d5ceddcd7 Mon Sep 17 00:00:00 2001 From: Hillel Arnold Date: Fri, 17 Sep 2021 17:01:39 -0400 Subject: [PATCH 1/5] remove comment --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a788da2..3d04ae2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,8 +15,6 @@ matrix: - python: "3.7" env: TOXENV=py37 - # Linters - - python: "3.7" env: TOXENV=linting From 82b28e39db0cc7fb8d827eed7caabb0cc9fd5898 Mon Sep 17 00:00:00 2001 From: Hillel Arnold Date: Fri, 17 Sep 2021 17:01:56 -0400 Subject: [PATCH 2/5] implement coverage --- .gitignore | 1 + tox.ini | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a30e297..37d1de4 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ __pycache__/ build/ .tox/ +.coverage diff --git a/tox.ini b/tox.ini index 8a2ce6c..5fbe51f 100644 --- a/tox.ini +++ b/tox.ini @@ -7,8 +7,11 @@ deps = pytest requests six + coverage skip_install = True -commands = pytest +commands = + coverage run -m --source=./electronbonder pytest -s + coverage report -m [testenv:linting] basepython = python3 From e310b6108191affabc7199712731d2a9e3fce869 Mon Sep 17 00:00:00 2001 From: Hillel Arnold Date: Fri, 17 Sep 2021 17:02:21 -0400 Subject: [PATCH 3/5] clean up README --- README.md | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 34cb0a1..87a2189 100755 --- a/README.md +++ b/README.md @@ -1,41 +1,26 @@ # ElectronBonder A client library for working with the Project Electron APIs. -## Credits -This code is basically stolen from [ArchivesSnake](https://github.com/archivesspace-labs/ArchivesSnake/). - -## Requirements -ElectronBonder has the following requirements. +## Getting started -- Python 3.4 or higher -- ability to install packages via pip ([Pipenv](https://docs.pipenv.org/) is recommended for development) - -## Installation -The easiest way to install ElectronBonder is via pip: +Make sure this library is installed: pip3 install ElectronBonder -You'll need an internet connection to fetch ElectronBonder's dependencies. -## Usage -To start, you must create a client with a baseurl: +Then create a client with a baseurl, a username and a password: ``` python from electronbonder.client import ElectronBond -client = ElectronBond(baseurl="http://my.aspace.backend.url.edu:4567") +client = ElectronBond( + baseurl="http://my.aspace.backend.url.edu:4567", + username="admin", + password="TopSecr3t") ``` - -## Configuration - -As per the example above, the client object should be configured by passing it arguments during creation. - -Allowed configuration values are: - -| **Setting** | **Description** | -|-------------|-------------------------------------------------------------------------------| -| baseurl | The location (including port if not on port 80) of the application's API root | +## Credits +This code is basically stolen from [ArchivesSnake](https://github.com/archivesspace-labs/ArchivesSnake/). ## License From b20101c33cfdf0df39c5ba3ac0c30c0240d55023 Mon Sep 17 00:00:00 2001 From: Hillel Arnold Date: Fri, 17 Sep 2021 17:02:36 -0400 Subject: [PATCH 4/5] get rid of unnecessary code --- electronbonder/client.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/electronbonder/client.py b/electronbonder/client.py index ec535fa..5b520b2 100755 --- a/electronbonder/client.py +++ b/electronbonder/client.py @@ -73,15 +73,12 @@ def __init__(self, **config): self.session.headers.update({"Accept": "application/json", "User-Agent": "ElectronBond/0.1"}) - def authorize(self, username=None, password=None): + def authorize(self): """Authorizes the client against the configured microservice instance.""" - username = username or self.config["username"] - password = password or self.config["password"] - resp = self.session.post( "/".join([self.config["baseurl"].rstrip("/"), "get-token/"]), - data={"password": password, "username": username}) + data={"password": self.config["password"], "username": self.config["username"]}) if resp.status_code != 200: raise ElectronBondAuthError( From 8b3fd38e96135968ffff6a51d5a4b2249d847383 Mon Sep 17 00:00:00 2001 From: Hillel Arnold Date: Fri, 24 Sep 2021 09:18:38 -0400 Subject: [PATCH 5/5] downgrade linting to python 3.6 Co-authored-by: Hannah Sistrunk --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3d04ae2..b91974d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ matrix: - python: "3.7" env: TOXENV=py37 - - python: "3.7" + - python: "3.6" env: TOXENV=linting notifications: