Giter Site home page Giter Site logo

secret_santa's Introduction

Secret Santa Assignments

This is a really simple secret santa assignment script which emails each person the name of the person they're getting a gift for.

It needs dictionary of name:email key value pairs as input, and has an optional 'couples' input which will force the program to re-roll if any couple is buying a gift for their significant other.

It's not the best code in the world, but it was written in about 20 minutes before I had to head out and it got the job done. I figure it might be useful next year so it's worth holding onto.

Usage

To run the program, you need to call make_assignments and provide it with a dictionary. The dictionary should be built with 'name':'email' pairs, like

Then to run call secretSanta.make_assignments(sample_emails)

If you have couples and want to make sure no person buys a gift for their significant other, or that a specific group don't buy gifts for each other (for example memembers of a family), you can include a list of couples, where a couple is a list of the members (their names must be used in the emails dictionary as keys):

sample_couples = [['a', 'b'], ['c', 'd']]

And pass that in as well,

secretSanta.make_assignments(sample_emails, couples=sample_couples)

To just view results rather than emailing and make sure the program is opperating as expected, set send_emails = False and it'll print out the email message instead of sending it.

secretSanta.make_assignments(sample_emails, couples=sample_couples, send_email=False)

To send the emails

The program uses 'kmmessage' to send emails. kmmessage is a personal library I use to handle any messaging I need but the key componets to send the emails are built from the smtplib and email, so if you don't want to setup kmmessage, you can probably get around it using that.

A good example can be found here

secret_santa's People

Contributors

keiththeee avatar

Watchers

 avatar

secret_santa's Issues

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.