An open API service indexing awesome lists of open source software.

https://github.com/bendog/fuelwatch

Proof of concept of FuelWatch scrape and list api
https://github.com/bendog/fuelwatch

Last synced: 8 months ago
JSON representation

Proof of concept of FuelWatch scrape and list api

Awesome Lists containing this project

README

          

# Fuel Watch Rest/GraphQL api example

Proof of concept for a dynamic backend for Fuel Watch scraping.

## Django + Graphene + Django-Rest-Framework app

todo:

- Django Rest filter for date valid today
- Django GraphQL filter for date valid today

### setup a new database

cd fuelapp
./manage.py migrate
./manage.py runserver

then browse to to populate the database

### run an existing app

cd fuelapp
./manage.py runserver

then browse to for graphql interface
or browse to for django rest framework interface

### Django Rest Framework example queries

- price list for a collection of suburbs
- price list for a brand
- price list for a date
- location list ordered by suburb with prices >= a date

### Django Graphene graphql example queries

Search for all fuel in a suburb

```graphql
{
allLocations(suburb: "PERTH") {
edges {
node {
id
brand
address
prices {
edges {
node {
price
}
}
}
}
}
}
}
```

Search for all Caltex, Shell and BP, sorting by Price and return first 50

```graphql
{
allLocations(orderBy:"prices__price", first:50, brand_In:"Caltex,Shell,BP") {
edges {
node {
id
brand
address
prices {
edges {
node {
price
}
}
}
}
}
}
}
```

Seach for all Caltex, Shell and BP, where prices after a date are less than $1.35, ordering by price and returning the first 50

```graphql
{
allLocations(
orderBy: "prices__price",
first: 50,
brand_In: "Caltex,Shell,BP",
prices_Price_Lte: 135,
prices_Date_Gte: "2019-05-28",
) {
edges {
node {
id
tradingName
address
suburb
prices {
edges {
node{
price
}
}
}
}
}
}
}
```

## Flask app

todo:

- pretty much everything