Code Monkey home page Code Monkey logo

tweets's Introduction

tweets

App that fetchet tweets from Twitter and shows their basic statistics.

Overview

Background task fetches k recent tweets by phrase. Exposed API allows to see those tweets, their top hashtags, top user who made max amount of tweets, total amount of recently fetched tweets.

Stack

  • python 3.7
  • postgres 11+
  • redis

Background task performed with schedule library, which is lightweight and simple in comparison to celery.

API is created with starlette and hosted with uvicorn

All data for API responses is cached in redis.

Installation

  • Clone repository

:$ git clone https://github.com/pgtuk/tweets.git

:$ cd tweets

  • Create .env

:$ cp .env.example .env

  • Put your twitter consumer key to TWITTER_CONSUMER_KEY and secter to TWITTER_CONSUMER_SECRET in .env. Don't hesitate to change querying phrase PHRASE, tweets count TWEETS_COUNT and fetching interval TIME_INTERVAL. Check limits at Twitter API docs

Run in docker

:$ docker-compose up

Note: docker will run linters before starting app, but not tests - requires to add test database.

App will be available at '0.0.0.0:5000' by default

Run localy

  • If you want to run it locally you'll need python3.7, postgres and redis. Set up databases for deployment and tests. Test DB name assumed to be same as deployment db's name prefixed with test_.
  • Set up python virtual enviroment and install package dependencies

$: python3.7 -m venv venv

$: venv/bin/pip install -r requirements.txt

  • Use make to run linters, tests and app itself. See make help for more information.

tweets's People

Contributors

pgtuk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.