Toolkit for various fun and useful tasks
Project description
The fun package contains utilities that are entertaining yet somewhat useful. Maybe.
Installation
To install normally:
$ pip install fun-supergus
To install locally in ‘editable mode’, clone the GitHub repo and run:
$ pip install -e /path/to/package/fun
The package does not have any dependencies and was tested with Python 3.7.
Contact me if you have any questions. This is a project just for fun (obviously!) and I cannot guarantee a response, sorry.
Configuration
The communications module requires an email account to establish an SMTP session. You must configure the credentials listed at the top of fun/communications/communicator.py.
If you installed normally, you must navigate to the site-packages library of your current Python environment and edit the file.
If you installed in editable mode, you may prefer to edit the cloned repo using your favorite IDE.
Package Contents
The fun repository contains three folders:
communications: Use E.T’s communicator to send emails and SMS messages with a single command.
printing: Print fancy, formatted text to the console and flaunt your style.
bin: Executable examples.
After importing fun into your code, the utilities should be called directly using fun.<function>. See examples below.
How to Have Fun with E.T.’s Communicator!
First, import the package:
import fun
Try sending some messages. The communicator should work regardless of whether you are inside a company’s managed network or not, assuming you are running from an authenticated session.
# Using arbitrary phone numbers or emails:
fun.et.phone_home('Howdy, this is my message to you.', '734-555-5555', subject='Test message from Chris')
# Using the JSON directory in fun/communications/contact_list.json to target users:
fun.et.phone_home('There can never be too much foo.', 'joe', subject='Foo')
# Using the JSON directory to target groups:
fun.et.phone_home('Fear is the mindkiller.', ['admin', 'physics'], subject='I must not fear')
When using users or groups from the JSON directory, by default E.T. will send messages via email and SMS to each targeted person. You can modify this behavior by toggling the boolean options disable_sms and disable_email.
When providing explicit phone numbers or email addresses, you don’t need to worry about toggling the options - it’s handled automatically. Phone numbers can be any format, including an integer, but they must contain 10 digits after any leading 0s or 1s.
The contact directory is located at fun/communications/contact_list.json and can be edited freely.
Let’s use the directory and select either email or SMS:
# Only send emails to the group 'physics', no SMS:
fun.et.phone_home('Need those reports today.', 'physics', subject='TPS Reports', disable_sms=True)
# Only send SMS messages to the user 'joe', no emails:
fun.et.phone_home('There is no try.', 'joe', subject='Do or do not', disable_email=True)
Finally, you can add attachments to emails:
# Send email with attachment:
target='/documents/tps_report.xlsx' # A Path-like object
fun.et.phone_home('Check this out!', 'chris@somewhere.com', subject='Report', attachment=target)
How to Have Fun with Fancy Printing!
After importing the package, try printing some formatted text to the stdout console:
# See the docstring of fancy_print() for description of all options.
fun.fancy_print('I like pretty things', fg='light_pink', bold=True, framed=True)
Run the built-in demo to see everything the Fancy Printer can do:
# Run the built-in demo
fun.fancy_print('Foo Fighters Rule', demo=True)
That’s all for now. Be sure to have some Fun!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for fun_supergus-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44a2cbbd2cf1e2d4fc077563c98f5ef6b9c787683b75bc692862ef1cc0aa8cf8 |
|
MD5 | 99a1d32e8e6b45c5a7f3c3d1f7c24e9d |
|
BLAKE2b-256 | cb397a000c6e21913b41c13b15d6eadf5e01e260762807e513f825e220c07100 |