Update doc link in README.md

This commit is contained in:
Lucas Verney 2017-12-05 15:17:03 +01:00
parent daf16d88ba
commit 8a74a79ac2
4 changed files with 37 additions and 25 deletions

View File

@ -3,6 +3,8 @@ Flatisfy
Flatisfy is your new companion to ease your search of a new housing :)
<script src="https://liberapay.com/Phyks/widgets/button.js"></script>
<noscript><a href="https://liberapay.com/Phyks/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></noscript>
**Note**: This software is under heavy development at the moment, and the
database schema could change at any time. Do not consider it as being
@ -36,6 +38,9 @@ This code is not restricted to handling flats only!
See the [getting started guide](doc/0.getting_started.md). If you want to give
it a try quickly, you can have a look at the [Docker image](doc/2.docker.md).
Documentation for the whole app is available
[online](https://doc.phyks.me/flatisfy/).
## Documentation
@ -91,7 +96,14 @@ explicitly mentionned otherwise.
See the `CONTRIBUTING.md` file for more infos.
## Support
## API
Your Flatisfy instance is accessible through an API. API documentation is
available
[here](https://doc.phyks.me/flatisfy/flatisfy.web.routes.html#module-flatisfy.web.routes.api).
## Getting help
Feel free to open issues. An IRC channel is available at [irc://irc.freenode.net/flatisfy](irc://irc.freenode.net/flatisfy) as well.

View File

@ -18,6 +18,14 @@ from flatisfy.models.public_transport import PublicTransport
LOGGER = logging.getLogger(__name__)
MODULE_DIR = os.path.dirname(os.path.realpath(__file__))
TRANSPORT_DATA_FILES = {
"FR-IDF": "stops_fr-idf.txt",
"FR-NW": "stops_fr-nw.txt",
"FR-NE": "stops_fr-ne.txt",
"FR-SW": "stops_fr-sw.txt",
"FR-SE": "stops_fr-se.txt"
}
def french_postal_codes_to_quarter(postal_code):
"""
@ -129,18 +137,10 @@ def _preprocess_public_transport():
:return: A list of ``PublicTransport`` objects to be inserted in database.
"""
DATA_FILES = {
"FR-IDF": "stops_fr-idf.txt",
"FR-NW": "stops_fr-nw.txt",
"FR-NE": "stops_fr-ne.txt",
"FR-SW": "stops_fr-sw.txt",
"FR-SE": "stops_fr-se.txt"
}
public_transport_data = []
# Load opendata file
for area, data_file in DATA_FILES.items():
LOGGER.info("Building from public transport data %s." % data_file)
for area, data_file in TRANSPORT_DATA_FILES.items():
LOGGER.info("Building from public transport data %s.", data_file)
try:
with io.open(os.path.join(MODULE_DIR, data_file), "r",
encoding='utf-8') as fh:
@ -154,7 +154,7 @@ def _preprocess_public_transport():
lng=row[4]
))
except (IOError, IndexError):
LOGGER.error("Invalid raw opendata file: %s." % data_file)
LOGGER.error("Invalid raw opendata file: %s.", data_file)
return []
return public_transport_data

View File

@ -5,10 +5,10 @@ This modules defines an SQLAlchemy ORM model for a flat.
# pylint: disable=locally-disabled,invalid-name,too-few-public-methods
from __future__ import absolute_import, print_function, unicode_literals
import enum
import logging
import arrow
import enum
from sqlalchemy import (
Column, DateTime, Enum, Float, SmallInteger, String, Text
@ -109,7 +109,6 @@ class Flat(BASE):
return FlatUtilities.included
elif utilities == "H.C.":
return FlatUtilities.excluded
else:
return FlatUtilities.unknown
@validates("status")
@ -128,7 +127,7 @@ class Flat(BASE):
return self.status.default.arg
@validates("notation")
def validate_status(self, _, notation):
def validate_notation(self, _, notation):
"""
Notation validation method
"""

View File

@ -17,6 +17,8 @@ import flatisfy.data
from flatisfy.models import flat as flat_model
from flatisfy.models.postal_code import PostalCode
FILTER_RE = re.compile(r"filter\[([A-z0-9_]+)\]")
def JSONError(error_code, error_str):
"""
@ -105,7 +107,6 @@ def flats_v1(config, db):
db_query = db.query(flat_model.Flat)
# Handle filtering according to JSON API spec
FILTER_RE = re.compile(r"filter\[([A-z0-9_]+)\]")
filters = {}
for param in bottle.request.query:
filter_match = FILTER_RE.match(param)
@ -124,7 +125,7 @@ def flats_v1(config, db):
return {
"data": flats
}
except Exception as exc:
except Exception as exc: # pylint: disable= broad-except
return JSONError(500, str(exc))
@ -147,7 +148,7 @@ def flat_v1(flat_id, config, db):
return {
"data": _serialize_flat(flat, config)
}
except Exception as exc:
except Exception as exc: # pylint: disable= broad-except
return JSONError(500, str(exc))
@ -177,8 +178,8 @@ def update_flat_v1(flat_id, config, db):
try:
json_body = json.load(bottle.request.body)
for k, v in json_body.items():
setattr(flat, k, v)
for key, value in json_body.items():
setattr(flat, key, value)
except ValueError as exc:
return JSONError(
400,
@ -188,7 +189,7 @@ def update_flat_v1(flat_id, config, db):
return {
"data": _serialize_flat(flat, config)
}
except Exception as exc:
except Exception as exc: # pylint: disable= broad-except
return JSONError(500, str(exc))
@ -213,7 +214,7 @@ def time_to_places_v1(config):
return {
"data": places
}
except Exception as exc:
except Exception as exc: # pylint: disable= broad-except
return JSONError(500, str(exc))
@ -245,7 +246,7 @@ def search_v1(db, config):
return {
"data": flats
}
except Exception as exc:
except Exception as exc: # pylint: disable= broad-except
return JSONError(500, str(exc))
@ -284,7 +285,7 @@ def ics_feed_v1(config, db):
description += '\n{}\n'.format(flat.notes)
vevent.add('description').value = description
except:
except Exception: # pylint: disable= broad-except
pass
return cal.serialize()