README updated

master
blallo 2019-01-21 09:32:52 +01:00 committed by blallo
parent dc20c91933
commit 1d3a943e74
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F
2 changed files with 37 additions and 9 deletions

View File

@ -12,11 +12,28 @@ Features
--------
* Login/Logout
* Check in/Check out
Install
-------
Either clone this repo and `pip install .` or use one of the provided packages.
Pay attention: this package needs a working binary of [geckodriver](https://github.com/mozilla/geckodriver).
You can either proceed in one of the following ways:
* Install the source distribution and put in your `$PATH` the `geckodriver` binary
(that can be downloaded [here](https://github.com/mozilla/geckodriver/releases/))
* Install the wheel for your architecture
* `pip install .` or `pip install -e .` will download the latest `geckodriver` and
put it in a path where the code will be able to find it.
*BEWARE*: the code gives precedence to the `geckodriver` in `$PATH` over that donwloaded.
TODO
----
* Check in/out
* systemd {unit, timer}
* APIs
* ...
[x] Check in/out
[ ] systemd {unit, timer}
[ ] APIs
[ ] Mailer

View File

@ -9,16 +9,27 @@ from datetime import datetime, timedelta
import logging
import os
import pkg_resources
import shutil
import sys
import time
import typing as T
from urllib.parse import urlparse
os.environ["PATH"] = (
os.environ["PATH"] + ":" + pkg_resources.resource_filename(__name__, "bin")
)
geckoexe = shutil.which("geckodriver")
if geckoexe is None:
local_path = pkg_resources.resource_filename(__name__, "bin")
try:
os.stat(os.path.join(local_path, "geckodriver"))
os.environ["PATH"] = os.environ["PATH"] + ":" + local_path
except FileNotFoundError:
print("Missing geckodriver executable in path", file=sys.stderr)
raise
from selenium import webdriver as wd
from selenium.common.exceptions import WebDriverException, NoSuchElementException
from selenium import webdriver as wd # noqa
from selenium.common.exceptions import (
WebDriverException,
NoSuchElementException,
) # noqa
logging.basicConfig(