Skip to content
This repository has been archived by the owner on May 4, 2021. It is now read-only.

A scrapy spider that scraps times and prices from Voyages Sncf. It uses scrapyrt to provide an API interface.

Notifications You must be signed in to change notification settings

adipasquale/voyages-sncf-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Voyages-SNCF API

a scrapyrt API to retrieve data from voyages-sncf.mobi website

Local setup

$ mkvirtualenv sncflolapi
$ workon sncflolapi
$ pip install -r requirements.txt

If you run into problems with the cryptography package on a osx machine, run this:

$ brew install pkg-config libffi openssl
$ env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography

(cf this SO thread)

Run Server

if you want livereload, run pip install watchdog and then :

$ workon sncflolapi
$ ./bin/run_local_server

Run crawl from CLI

Useful for debugging, especially to use the inspect_response helper.

$ cd voyagessncf
$ scrapy crawl voyagessncf_mobi -a departure_city=paris -a arrival_city=avignon -a departure_date="01/04/2016" -a departure_hour="18h"

or

$ scrapy crawl voyagessncf_com -a departure_city=paris -a arrival_city=avignon -a departure_date="10/03/2017" -a departure_hour="8"

Call API

$ brew install httpie
$ http "http://localhost:9080/crawl.json" departure_city==marseille arrival_city==paris departure_date=="22/03/2017" card==TGVMAX precise_departure_time=="06h11" price_below==80

or with raw curl :

$ curl "http://localhost:9080/crawl.json?departure_date=11%2F03%2F2017&departure_city=paris&arrival_city=rennes&departure_hour=8&card=TGVMAX"

About

A scrapy spider that scraps times and prices from Voyages Sncf. It uses scrapyrt to provide an API interface.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages