GithubHelp home page GithubHelp logo

schwerdt / packagemonster Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 172 KB

A flask application that accepts package labels and reports the current package count for each unique package label.

Python 100.00%

packagemonster's Introduction

Install a virtual environment using
virtualenv . 

Then install the requirements that are listed in requirements.txt using 
source bin/activate
pip install -r requirements.txt
deactivate

accumulator_config.py.default is a template for the configuration file.
Copy it to accumulator_config.py 
(cp accumulator_config.py.default accumulator_config.py)
before starting the accumulator. Edit accumulator_config.py 
to reflect your url to the accumulator and your desired number 
of POST attempts.

To start the accumulator, type:
bin/python accumulator.py

The accumulator has two GET routines and a POST 
routine.  The send_label_to_accumulator function
in conveyor_belt.py takes a package label, turns it
into a json format and sends the label to the accumulator.

Before you can add package labels via the accumulator's POST
method, you will need to create a username and password. This can
easily be done in an interactive session by using the create_user 
function in conveyor_belt.py. create_user uses another one of 
the accumulator's POST functions to add a new user to the 
database of AuthorizedUsers.

from conveyor_belt import create_user
create_user('conveyor_belt', 'test_password')

You use send_label_to_accumulator to pass data to the accumulator. 
You use the two GET methods to get data back out of the accumulator. 

You can get all package labels:
http://localhost:5000/accumulator/get_package_labels

Or you can get a specific label (packages for Christine in this example):
http://localhost:5000/accumulator/get_packages/Christine


---------------------------------------------------
The conveyor_belt.py file:

This file contains functions for interacting with the accumulator. 
Its functions are:
send_package_to_accumulator
conveyor_belt
create_user

The conveyor belt is simply a function that generates package labels
and sends them to the accumulator using the send_package_to_accumulator
function.  The send_package_to_accumulator function sends the label info to the
accumulator and needs authentication information to be passed with the package 
label information.  Currently this information is read from a file 
(conveyor_password).  In the repository a file called conveyor_password.default 
is included so you can see the format in which to add your username 
and password to the file. Copy this file to conveyor_password and 
change the contents to include the username and password you 
created using the create_user function. 

cp conveyor_password.default conveyor_password





packagemonster's People

Contributors

schwerdt avatar

Stargazers

Anne Thorpe avatar Seth Difley avatar Tanya Schlusser avatar

Watchers

James Cloos avatar  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.