-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ccde415
Showing
122 changed files
with
20,887 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
### MANAGED START ### | ||
# http://editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
charset = utf-8 | ||
end_of_line = lf | ||
|
||
[*.bat] | ||
indent_style = tab | ||
end_of_line = crlf | ||
|
||
[LICENSE] | ||
insert_final_newline = false | ||
|
||
[Makefile] | ||
indent_style = tab | ||
|
||
### MANAGED STOP ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
### MANAGED START ### | ||
# Packages | ||
*.egg | ||
*.egg-info | ||
/dist/ | ||
/build/ | ||
/eggs/ | ||
/parts/ | ||
/var/ | ||
/sdist/ | ||
/develop-eggs/ | ||
.installed.cfg | ||
/lib/ | ||
/lib64/ | ||
|
||
*.py[cod] | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Installer logs | ||
pip-log.txt | ||
|
||
# Unit test / coverage reports | ||
.coverage | ||
.tox | ||
nosetests.xml | ||
htmlcov | ||
test-output | ||
|
||
# Translations | ||
*.mo | ||
|
||
# Mr Developer | ||
.mr.developer.cfg | ||
.project | ||
.pydevproject | ||
|
||
# Complexity | ||
output/*.html | ||
output/*/index.html | ||
|
||
# Sphinx | ||
docs/_build | ||
|
||
# pyCharm | ||
.idea | ||
|
||
# VirtualEnv | ||
env | ||
env* | ||
|
||
# Mac | ||
.DS_Store | ||
|
||
|
||
### MANAGED STOP ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pep257: | ||
disable: | ||
- D203 | ||
ignore-paths: | ||
- _CI | ||
- build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
======= | ||
Credits | ||
======= | ||
|
||
Very loosely based on https://github.com/OVChip/ovchipapi-python for the | ||
authentication part. | ||
|
||
|
||
Development Lead | ||
---------------- | ||
|
||
* Costas Tyfoxylos <[email protected]> | ||
|
||
Contributors | ||
------------ | ||
|
||
None yet. Why not be the first? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
============ | ||
Contributing | ||
============ | ||
|
||
Contributions are welcome, and they are greatly appreciated! Every | ||
little bit helps, and credit will always be given. | ||
|
||
Submit Feedback | ||
~~~~~~~~~~~~~~~ | ||
|
||
If you are proposing a feature: | ||
|
||
* Explain in detail how it would work. | ||
* Keep the scope as narrow as possible, to make it easier to implement. | ||
|
||
Get Started! | ||
------------ | ||
|
||
Ready to contribute? Here's how to set up `ovchipcardlib` for local development. | ||
|
||
1. Clone your fork locally:: | ||
|
||
$ git clone https://github.com/costastf/ovchipcardlib.git | ||
|
||
2. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your clone for local development:: | ||
|
||
$ mkvirtualenv ovchipcardlib | ||
$ cd ovchipcardlib/ | ||
$ python setup.py develop | ||
|
||
3. Create a branch for local development:: | ||
|
||
$ git checkout -b name-of-your-bugfix-or-feature | ||
|
||
Now you can make your changes locally. | ||
|
||
4. Commit your changes and push your branch to the server:: | ||
|
||
$ git add . | ||
$ git commit -m "Your detailed description of your changes." | ||
$ git push origin name-of-your-bugfix-or-feature | ||
|
||
5. Submit a merge request |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.. :changelog: | ||
History | ||
------- | ||
|
||
0.1 (14-04-2017) | ||
--------------------- | ||
|
||
* First release on pypi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2017 Costas Tyfoxylos | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
include .VERSION | ||
include AUTHORS.rst | ||
include CONTRIBUTING.rst | ||
include HISTORY.rst | ||
include LICENSE | ||
include README.rst | ||
include USAGE.rst | ||
include requirements.txt | ||
include ovchipcardlib/.VERSION | ||
recursive-include requirements *.txt | ||
|
||
|
||
recursive-exclude * __pycache__ | ||
recursive-exclude * *.py[co] | ||
|
||
recursive-include docs *.rst conf.py Makefile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
============= | ||
ovchipcardlib | ||
============= | ||
|
||
A library to interact with the ov-chip card service. | ||
|
||
It utilizes the webapi of the mobile apps to get the information. | ||
Very loosely based on https://github.com/OVChip/ovchipapi-python for the | ||
authentication part. | ||
|
||
Be aware that the ov-chip card system used in the Netherlands for public | ||
transport was not designed to be real time. So expect a hefty time drift | ||
before the actual checkin/out action and information showing up on the api | ||
and by extension on the transactions list. | ||
|
||
Also the sequence of transactions is not guaranteed. It is absolutelly | ||
certain that if there are a lot of checkins/outs closely together they will | ||
appear out of order on the web api. Apparently there is a serverside job that | ||
sorts them once a day. | ||
|
||
The library handles that by sorting the list of transactions always. So on | ||
any action it would return a properly ordered list of events but in case of | ||
monitoring through the card.get_latest_transactions() method it is | ||
absolutelly guaranteed that transaction will appear out of order and with a | ||
delay ranging between 2 and 15 minutes according to some simple benchmarks. | ||
|
||
|
||
* Documentation: http://ovchipcardlib.readthedocs.io/en/latest/ | ||
|
||
Features | ||
-------- | ||
|
||
* Can get cards bound with the account and lists of transactions for the cards. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
===== | ||
Usage | ||
===== | ||
|
||
To use ovchipcardlib in a project in an event watching loop you could use the | ||
following code. | ||
|
||
.. code-block:: python | ||
from ovchipcardlib import Service | ||
from time import sleep | ||
from datetime import datetime | ||
ovchip_username = 'OVCHIP_USERNAME' | ||
ovchip_password = 'OVCHIP_PASSWORD' | ||
card_name = 'Mijn OV-Chipkaart' | ||
service = Service(ovchip_username, ovchip_password) | ||
card = service.get_card_by_alias(card_name) | ||
print('Monitoring card with number {}'.format(card.number)) | ||
print('Getting all historic transactions') # here we discard all the old | ||
# ones since we want to monitor | ||
card.get_latest_transactions() | ||
print('Got all transactions. Entering the monitoring loop...') | ||
while True: | ||
for transaction in card.get_latest_transactions(): | ||
now = datetime.now() | ||
time_shift = now - transaction.datetime | ||
delay_message = 'Delay of transaction logging :{}'.format(time_shift) | ||
body = '\n'.join((str(transaction), delay_message)) | ||
print('Transaction logged at {}'.format(now)) | ||
print(body) | ||
print(delay_message) | ||
sleep(60) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
cd $(dirname $0)/../.. | ||
|
||
source $(which virtualenvwrapper.sh) | ||
|
||
[ -z "$WORKON_HOME" ] && WORKON_HOME=$HOME/.virtualenvs | ||
|
||
if (! test -d "$WORKON_HOME/ovchipcardlib") | ||
then | ||
echo "Creating virtual env for ovchipcardlib" | ||
if (! mkvirtualenv "ovchipcardlib" ) | ||
then | ||
echo "Missing prerequisite virtualenvwrapper, bailing out" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
echo "Working on virtualenv ovchipcardlib" | ||
source "$WORKON_HOME/ovchipcardlib/bin/activate" | ||
|
||
echo "Installing python package requirements.." | ||
pip install -r requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash --login | ||
set -e | ||
cd $(dirname $0)/../.. | ||
|
||
. _CI/scripts/bootstrap | ||
|
||
rm -rf build dist | ||
|
||
# we want all these files to exist in the actual package | ||
cp .VERSION ovchipcardlib/.VERSION | ||
cp LICENSE ovchipcardlib/LICENSE | ||
cp AUTHORS.rst ovchipcardlib/AUTHORS.rst | ||
cp CONTRIBUTING.rst ovchipcardlib/CONTRIBUTING.rst | ||
cp HISTORY.rst ovchipcardlib/HISTORY.rst | ||
cp README.rst ovchipcardlib/README.rst | ||
cp USAGE.rst ovchipcardlib/USAGE.rst | ||
|
||
python setup.py sdist bdist_egg | ||
|
||
rm ovchipcardlib/.VERSION | ||
rm ovchipcardlib/LICENSE | ||
rm ovchipcardlib/AUTHORS.rst | ||
rm ovchipcardlib/CONTRIBUTING.rst | ||
rm ovchipcardlib/HISTORY.rst | ||
rm ovchipcardlib/README.rst | ||
rm ovchipcardlib/USAGE.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash --login | ||
cd $(dirname $0)/../.. | ||
|
||
. _CI/scripts/bootstrap | ||
pip install -r requirements/documentation.txt | ||
|
||
rm -f docs/test_docs.rst | ||
rm -f docs/modules.rst | ||
rm -rf _build docs/_build | ||
|
||
echo "Running make docs.." | ||
|
||
make -C docs html && \ | ||
mv -v docs/_build _build | ||
exit_code=$? | ||
if ([ $exit_code != 0 ]) | ||
then | ||
echo "Failed building documentation" | ||
exit exit_code | ||
fi | ||
open _build/html/index.html 2> /dev/null|| xdg-open _build/html/index.html 2> /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash --login | ||
set -e | ||
cd $(dirname $0)/../.. | ||
|
||
. _CI/scripts/bootstrap | ||
|
||
pip install -r requirements/testing.txt | ||
|
||
prospector -DFM && echo No issues found |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash --login | ||
cd $(dirname $0)/../.. | ||
|
||
. ./_CI/scripts/bootstrap | ||
|
||
pip install -r requirements/testing.txt | ||
|
||
rm -rf test-output | ||
mkdir -p test-output | ||
tox | ||
exit_code=$? | ||
open test-output/coverage/index.html 2> /dev/null|| xdg-open test-output/coverage/index.html & | ||
sleep 1 | ||
open test-output/nosetests.html 2> /dev/null|| xdg-open test-output/nosetests.html & | ||
exit $exit_code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash --login | ||
set -e | ||
cd $(dirname $0)/../.. | ||
|
||
. _CI/scripts/bootstrap | ||
|
||
rm -rf build dist | ||
|
||
# we want all these files to exist in the actual package | ||
cp .VERSION ovchipcardlib/.VERSION | ||
cp LICENSE ovchipcardlib/LICENSE | ||
cp AUTHORS.rst ovchipcardlib/AUTHORS.rst | ||
cp CONTRIBUTING.rst ovchipcardlib/CONTRIBUTING.rst | ||
cp HISTORY.rst ovchipcardlib/HISTORY.rst | ||
cp README.rst ovchipcardlib/README.rst | ||
cp USAGE.rst ovchipcardlib/USAGE.rst | ||
|
||
python setup.py sdist bdist_egg upload -r pypi | ||
|
||
rm ovchipcardlib/.VERSION | ||
rm ovchipcardlib/LICENSE | ||
rm ovchipcardlib/AUTHORS.rst | ||
rm ovchipcardlib/CONTRIBUTING.rst | ||
rm ovchipcardlib/HISTORY.rst | ||
rm ovchipcardlib/README.rst | ||
rm ovchipcardlib/USAGE.rst |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.