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
- Host: GitHub
- URL: https://github.com/bendog/fuelwatch
- Owner: bendog
- Created: 2019-05-27T17:10:07.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-27T10:01:40.000Z (almost 7 years ago)
- Last Synced: 2025-04-02T12:49:27.936Z (about 1 year ago)
- Language: Python
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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