Giter Site home page Giter Site logo

ww_tweeter's Introduction

WW Tweeter Application

Build Status

Linting Status: Linting Status:

pytest Status: pytest Status

Code Analysis: Better Code Hub Analysis

Application for #100DaysOfCode

This project is the result of a challenge from days 59-60 in the TalkPython #100DaysOfCode course.

The lesson focuses on learning to use the Python Tweepy module to interact with the Twitter API and the course suggests a number of challenges to get practice with the lesson content, listed at the end of this Jupyter Notebook. I wanted to learn to build a full-fledged application, so I chose to follow the example in the RealPython article: Building a web app with Bottle, SQLAlchemy, and the Twitter API.

Over roughly two months, my version of the application gave me extensive practice with topics like:

  • Classes, including class inheritance.
  • GitHub Actions
  • pytest
  • Tweepy
  • PostgreSQL
  • PGAdmin
  • SQLAlchemy
  • Containerized applications with Docker
  • Docker Compose
  • Clean code writing using Better Code Hub
  • bottle
  • Visual Studio Code development containers
  • Docker Compose

I successfully built an application that: - Uses Tweepy to retrieve a set tweets for the wwt_inc Twitter account. - Extract hashtags from the set of tweets. - Builds database tables in a PostgreSQL database for tweets and hashtags using SQLAlchemy. - Loads tweets and hashtags into the database. - Write pytest tests that mock several Tweepy and SQLAlchemy objects/classes. - Read tweets and hashtags from the database, optionally filtering data. - Display tweets and hashtags with a bottle hosted web application.

My application uses Docker Compose to build the following components: - 1 x PostgreSQL container. - 1 x Pgadmin container. - 1 x Application container for Python applications that interact with Twitter and PostgreSQL, plus serve a web application with bottle. - 1 x Docker network with auto-DNS. - 1 x Docker persistent volume for database storage. - Several local volume mounts for container code consumption and Pgadmin configuration storage.

To give the application a try for yourself, I recommend the following setup steps:

  1. Clone this repository to an environment with Docker and Docker Compose runtime environments, plus an Internet connection.

  2. Use your shell prompt to navigate to the cloned repository.

  3. Create the following .env files and populate the variable values with the appropriate information:

    # ./app/.env
    APP_DB_USER=db_user
    APP_DB_PASS=
    APP_LOCATION=local
    POSTGRES_USER=root
    POSTGRES_PASSWORD=
    DB_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/ww_tweeter
    DB_TEST_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/ww_tweeter_test
    TWITTER_KEY=
    TWITTER_SECRET=
    TWITTER_ACCESS_TOKEN=
    TWITTER_ACCESS_SECRET=
    # ./dockerfiles/db/.env
    APP_DB_USER=db_user
    APP_DB_PASS=
    POSTGRES_USER=root
    POSTGRES_PASSWORD=
    # ./dockerfiles/db_admin/.env
    [email protected]
    PGADMIN_DEFAULT_PASSWORD=
  4. Enter the following command in your shell:

    docker compose up -d
  5. Wait a few minutes for the images to build and for the containers to start.

  6. Attach to the application container with the following command:

    docker exec -it ww-tweeter-app-1 /bin/bash
  7. Start the Python application with the following command:

    ./app/tweeter/ww_tweeter.py
  8. Navigate to the web application with a browser.

Take note that this application is built for learning, development, and testing, so the Python application does not automatically start (via the Dockerfile CMD or ENTRYPOINT instructions) and SQLAlchemy and bottle debugging are active.

ww_tweeter's People

Contributors

timothyhull 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.