GithubHelp home page GithubHelp logo

virtual-league-data-bot's Introduction

Bot Info

The aim of the Virtual-League-Data-Bot is to get all match fixation results per week in a premier league(virtual) by scraping the data from a popular sporting site, formats and cleans the data and then pushes it to a google sheet using Sheety API. This program is containerised using docker, pushed to a private repo in an AWS Container Registry and is run by in an AWS Lambda function, triggered every 4 minutes.

Requirements

  • Docker
  • Selenium
  • Requests
  • Have at least a free tier account in AWS

How to use the bot

  • Clone the repo

  • Create a new google spreadsheet and rename it from "Untitled" to a name of your choosing

  • Below the spreadsheet, change the name of the open sheet from "sheet1" to "League Table". Please note that if you decide to use a different sheet name (this is different from the spread sheet name above), then you must update the data dictionary in the function: send_to_google_sheet in main.py like so:

    # change "leagueTable" to your desired name, using camel case without a space and the first letter must be lower case even if the name of the sheet starts with an upper case
    body = {
        "leagueTable": final_data 

    }

The above step is very essential for use with the API

  • To use the Sheety API, click this link to create an account:

    • Read the documentation on how to connect the google sheet created above with the API
    • Create a Basic Authentication with a username and password
    • Retrieve your specific url from the API
    • Enable GET,POST and/or PUT requests
  • Create environment variables in your local machine if you choose to run the bot locally. Otherwise, do likewise in whatever environment you choose to run the bot

    • Variable name: LEAGUE_SHEETY_ENDPOINT , key: THE URL YOU GET FROM SHEETY API
    • Variable name: LEAGUE_SHEETY_PASSWORD, key: YOUR PASSWORD INPUTED IN THE BASIC AUTHENTICATION PART OF THE SHEETY API
    • Variable name: LEAGUE_SHEETY_USER_NAME, key: YOUR USERNAME INPUTED IN THE BASIC AUTHENTICATION PART OF THE SHEETY API
  • Open your terminal and install awscli

  • Log in to your AWS account and create a private repo in AWS ECR

Running the bot

  • In your AWS management console, click on " View push commands "
  • Copy and paste the commands in your terminal and click enter one after the other
  • Create an AWS Lambda function with the option of container
  • Update the general configuration with RAM of 1000 and increase timeout to at least 5 mins
  • Update environment variables in the lambda function with the ones created above
  • Create a trigger event with 4 minutes

virtual-league-data-bot's People

Contributors

trust914 avatar

Stargazers

 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.