- verion: 0.0.1
- Listen Everything From Tweets
Usage
Install App
Install Python 3.6+ and python packages
-
install python3.6+
- please refer https://www.python.org/
-
install python packages
pip install -r requirements.txt
- if you have multiple python, you may use following command to avoid problem
python3.6 -m pip install -r requirements.txt
-
(optionnal) set up Twitter api token as environment varable for the server
export TWITTER_TOKEN=xxx..xxx
Install Docker Image
docker pull yanganto/left
Run test
- run test case at project root
python3 -m pytest
Run Service
run with TWITTER_TOKEN environment varlable
-
run service on 8080 (default) port
python3 left.py
-
run service on specific port
python3 left.py -p [port number]
run without environment varlable setting
-
run service with Twitter API Token option
python3 left.py -t [api token]
-
run service with Twitter API Keys options
python3 left.py -k [api key] -s [api secret key]
run with docker
docker run -p 8080:8080 -e TWITTER_TOKEN='xxx..xxx' yanganto/left
Make a query
-
cRUL command
curl -H "Accept: application/json" -X GET http://localhost:8080/hashtags/Python?limit=40
-
try the API by living swagger document
firefox http://localhost:8080/doc
- swagger document page
Notes
The api need to be query with accept header,
and the accept header is not suitable for flask-restplus framework.
so I did a PR on this.
di/flask-accept#8
If there is any bug or issue, please kindly to tell me.
Thanks.