Coder Social home page Coder Social logo

kianapaz / ferrytimes-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from samuel-pratt/bc-ferries-api

0.0 1.0 0.0 98 KB

The only public API for retrieving current data on BC Ferries sailings.

Home Page: https://ferrytimes.ca

License: MIT License

Python 69.54% HTML 30.46%

ferrytimes-api's Introduction

FerryTimes API - ferrytimes.ca

The only public API for retrieving current data on BC Ferries sailings.

How It's Made

FerryTimes is a flask api connected to a python web scraper. The scraper is made with BeautifulSoup4 and Pandas. It runs every 3 minutes and saves the relevant, formatted data to a json 'database' made with flata. When flask recieves a request, it checks the validity of the request, then returns the specified data.

The frontend is made with HTML, Bootstrap, and Javascript. When the user hits the request button, it runs a small script that calls the api with the user's request, and displays the info on the page.

Built with

API Reference

The api runs on the format:

https://www.ferrytimes.ca/api/<departure-terminal>/<destination-terminal>

You can be as specific as needed, the fewer arguments there are, the more data you will recieve.

For example, https://www.ferrytimes.ca/api/tsawwassen will return all data for all sailings leaving from Tsawwassen.

If the response is empty and shows no errors, it just means there may not be any more sailings for that terminal, this usually happens later at night.

Options for each are as follows:

departure-terminal

"tsawwassen"
"swartz-bay"
"nanaimo-(duke-pt)"
"nanaimo-(dep.bay)"
"horseshoe-bay"
"langdale"
"snug-cove-(bowen-is.)"

destination-terminal

Note: destination terminal must correspond with departure terminal, for example you can't put tsawwassen to langdale, it will return an error.

"tsawwassen": [
    "swartz-bay"
    "southern-gulf-islands"
    "duke-point"
]
"swartz-bay": [
    "tsawwassen"
    "fulford-harbour"
]
"nanaimo-(duke-pt)": [
    "tsawwassen"
]
"nanaimo-(dep.bay)": [
    "horseshoe-bay"
]
"horseshoe-bay": [
    "departure-bay"
    "langdale"
    "snug-cove-(bowen-is.)"
]
"langdale": [
    "horseshoe-bay"
]
"snug-cove-(bowen-is.)": [
    "horseshoe-bay"
]

Errors

If any of the parameters are not from the above, you will see one of the following errors:

"Error: Not a valid departure terminal."
"Error: Not a valid destination terminal."

If you see an error not included in this list, there may be an issue with the API, please submit an issue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.