Simple Flask web app, which integrates a hashtag search for geolocalization and displays twitts by country on GoogleMaps.
https://ppw2v8syjg.execute-api.eu-west-1.amazonaws.com/dev
- Install requirimets:
$ pip -r requirements/base.txt
- Pupulate your .env file with the following lines (see config_examples)
- export
twitteruser=''
# Twitter user from which we want to get twitts: "screen_name" - export
consumer_key=''
# go here and create your twitter app - export
consumer_secret=''
# go to "manage keys and access tokens" to see your consumer_secret key - export
access_token_key=''
# download, run this script and follow instructions - export
access_token_secret=''
- export
GOOGLEMAPS_KEY=''
# get here - export
SECRET_KEY=''
# Randomly generated string used by Flask for your cookies and other stuff
- export
- Run
. .env; python main.py
- Responsive Mobile devices desing with Bootstrap
- Displays the geolocalised twitts in GoogleMaps, each marker includes a text box with the twitter link to the article or twitt Id.
Build your local Docker image
docker build . -t flask-twitterapi:latest
OR download from Docker hub
docker pull blgo/flask-twitterapi:latest
Rename your .env file to "env" and run:
. .env; \
docker run --rm --name flask-twitterapi-run \
-e twitteruser="${twitteruser}" \
-e consumer_key="${consumer_key}" \
-e consumer_secret="${consumer_secret}" \
-e access_token_key="${access_token_key}" \
-e access_token_secret="${access_token_secret}" \
-e GOOGLEMAPS_KEY="${GOOGLEMAPS_KEY}" \
-e SECRET_KEY="${SECRET_KEY}" \
-p 80:80 flask-twitterapi:latest
Access the application: http://localhost
Optimise country search, analyse performance using QcachegrindCreate .env and zappa_setting example filesTest Docker image, amend Dockerhub READMEAdd https URLs for Twitter imagesSanitise dependencies- Autodeploy to AWS LAMBDA using Travis only for master
- Limit Zappa IAM user and roles privileges (edit example config file)
- Make tool to analyse code performance:
python -m cProfile -o profile_data.pyprof tests/gettwitts_tests.py
python -m pyprof2calltree -i profile_data.pyprof -k
&& https://gitlab.com/blgo/learn-more-python-the-hard-way/blob/master/ex6-find/find.py comand line arguments parser.