Automated Mailing System with Python - python

I’m not a very experienced programmer. Trying to learn python by myself. I want to create a python file that will run every morning. And when this program runs, it will check all the employees first hired date to the company and if it’s the anniversary, it will automatically send an e-mail to that employee saying “thank you etc...” using an html template. And also it will send the same e-mail to that employee’s manager.
So my idea is to create a dictionary containing the employees and also add a field to indicate their manager.
Every morning the code will compare each employees hiring date with that current comparing date and when it finds out it’s the anniversary for that employee it will send this celebration e-mail to him/her and to his/her manager.
I’m planning to write the code first with python. After I finish the code, I’ll try to move it to django. (I haven’t learnt django yet so I can’t do it now)
I’m also not very good at using classes. So I’m planning to do this by creating functions.
Do you have any suggestion for me? Is there any point I should be paying attention? Or is there any method you would suggest me to use?
Thank you very much in advance.

Related

Using amazon alexa echo in my application

I am working on a group project which entails generating many reports. We were thinking of using amazon echo. We would ask alexa to fetch the reports from a particular tine period or something like that.
We plan on doing so using Python.
It is possible using ASK(Alexa Skills Kit) SDK to achieve this goal ? Like, can alexa tap into our application and fetch all that we want. We do not want to use anything else other than Amazon echo.
I think it's possible you need to create a custom skill for that, there are somethings that you might want to consider though,
How long is the report: it will work fine if reports are small and giving you some brief overview or some numbers. you don't wanna listen to long report on that robotic voice.
Name of reports: sometimes Alexa will not understand or misunderstood the name you're trying to say if it's complex one.
meaning of tap into your application: In Alexa skill you can write custom logic just like you write for a software so If there's API to fetch reports then It can be done. The skill will call API and pass the data that you say to that skill, data like to date, from date etc.

An Email Report Application for Outlook

The sales folk in my start-up send and receive a bunch of mail on a daily basis from vendors. dealers and customers.
But they tend to lose track of these mails quite often...as to whether they have responded/followed-up or not. And they waste a lot of time on figuring this out.
Expecting them to use a Mail Tool like MailChimp is even more painful and a ticketing tool is not a good fit for the jobs.
Hence, I am trying to build an app that can create a report of the total Email IDs interacted with in a particular date range. The only goal is to create a report, in a csv file or to dump the data into Google spreadsheets.
The report for the period entered by the user would look as below:
Email ID - All emails lying in "sent items" AND "inbox" for particular date range
Name - If present
Status
The "Status" would be:
Received not responded by sales person
Sent but not responded by recipient
Responded by Sales Person
...and so on
I am vary of running the script directly on the mail server and am not sure if Outlook Exchange would allow something like this.
I would prefer if it could be an application that runs directly on the sales person's machine.
A few use Macs and the others Windows. I would be focussing on the Macs first.
The mail tool used is Outlook for Mac-2011 and the machines are either Lions or Snow Leopards.
Mail is on the Outlook Exchange
I must confess to be not much of a coder, but i blunder/Google my was through it.
I had some time on my hand with the holiday season coming up, hence thought of taking this project up.
I am moderately comfortable with Python.
But for this project, from what i have read, appears to be the job for AppleScripting.
Before starting my blunderings, i wanted to seek the advice of the SO community on the same:
Is AppleScripting the best bet here? If yes, could you share the best resource to read up the same. I have the copy of "AppleScript The Comprehensive Guide to Scripting and Automation on Mac OS X". But it is almsot 6 years old.
Could it be done somehow just using Python? - I wanted to dump the respective reports onto Google Spreadsheets, hence would be easier to get Python involved here.
Are there any similar applications that are already out there?
Or am i completely off track
Sorry for the ramble. But really Looking forward to some assistance on this
I liked:
AppleScript 1-2-3
and
AppleScript: The Definitive Guide
There also some good tutorials here: MacScripter
That being said, you should consider the cost/benefit of learning AppleScript to accomplish one task at your company. You may be better off simply hiring someone to write the script for you and focus on growing your business instead.

python-payflowpro on-demand payments

I'm trying to build a python solution where a user can enter a credit card which will be submitted and saved to the Payflow pro servers and can be billed on an on-demand basis. I know python-payflowpro supports recurring billing, but that occurs on a regular schedule, such as weekly or monthly. I'm looking to find a solution that will bill a user's card at their request without them having to enter in their card information.
I've looked through the payflow pro api docs and it looks like there is some feature where you can bill a user's account multiple times if you have the transaction id that payflow pro gives you. However, I'm not sure if this is only so merchants can make adjustments to an existing order (such as the customer wishes to later add an additional item). And I don't think that python-payflowpro supports this.
Has anyone used payflow in this way to store credit cards online and make on-demand payments to them? Is there an existing python api for this, whether it be python-payflowpro or something else? Or do I have to roll my own API for this?
I'm pretty new to payflow, so maybe I'm missing something obvious. Was wondering how other people approached this situation.
Thank you for reading and for your consideration.
Joe
This is the python-payflowpro package that I am currently using:
https://github.com/bkeating/python-payflowpro/blob/master/payflowpro/tests/client.py
Looking closer at the api source code, I found an undocumented function called reference_transaction, which allows reference transactions. It seems to allow you to make use of PayPal's Reference Transactions and allow you to store credit cards online and charge them on an ad-hoc basis.
https://github.com/bkeating/python-payflowpro/blob/master/payflowpro/client.py#L259
With a little digging, I found a way to utilize this api method, but had to do a few tricks to pass in the proper arguments. I've documented them here:
https://github.com/bkeating/python-payflowpro/issues/5

Facebook Style Wall / Activity log - General design help

I'm building a face-book style activity stream/wall. Using python/app engine. I have build the activity classes based on the current activity standard being used by face-book, yahoo and the likes. i have a Chanel/api system built that will create the various object messages that live on the wall/activity stream.
Where i can use some help is with some design ideas on how the wall should work. as follows:
I am using a fan out system. When something happens i send a message - making one copy but relating it to all that have subscribed to the channel it is written on. This is all working fine.
My original idea was to then simple use a query to show a wall - a simple get all the messages for a given channel or user. Which is fine.
But now I'm wondering if that is the best way to do it. I'm wondering if as the wall is a historical log that really should show "what has happened recently say last 90 days at the most. And that i will use Ajax to fetch the new messages. Is it better to use the message api i have built to send messages and then use a simple model/class/ to store the messages that form the wall for each user. Almost storing the raw HTML for each post. If each post was stored with its post date, object ref (comment,photo,event) it would be very easy to update/insert new entries in the right places and remove older ones. It would also be easy ajax side to simply listen for a new message. Insert it and continue.
I know their have been a lot of posts re "the wall" & "activity" stream does anyone have any thoughts i if my ideas are correct or off track?
Thanks
This is pretty much exactly what Brett Slatkin was talking about in his 2009 I/O talk. I'd highly recommend watching it for inspiration, and to see how a member of the App Engine team solves this problem.
Also you can check Opensocial API for design and maybe http://github.com/sahid/gosnippets.

I'm searching for a messaging platform (like XMPP) that allows tight integration with a web application

At the company I work for, we are building a cluster of web applications for collaboration. Things like accounting, billing, CRM etc.
We are using a RESTfull technique:
For database we use CouchDB
Different applications communicate with one another and with the database via http.
Besides, we have a single sign on solution, so that when you login in one application, you are automatically logged to the other.
For all apps we use Python (Pylons).
Now we need to add instant messaging to the stack.
We need to support both web and desktop clients. But just being able to chat is not enough.
We need to be able to achieve all of the following (and more similar things).
When somebody gets assigned to a task, they must receive a message. I guess this is possible with some system daemon.
There must be an option to automatically group people in groups by lots of different properties. For example, there must be groups divided both by geographical location, by company division, by job type (all the programers from different cities and different company divisions must form a group), so that one can send mass messages to a group of choice.
Rooms should be automatically created and destroyed. For example when several people visit the same invoice, a room for them must be automatically created (and they must auto-join). And when all leave the invoice, the room must be destroyed.
Authentication and authorization from our applications.
I can implement this using custom solutions like hookbox http://hookbox.org/docs/intro.html
but then I'll have lots of problems in supporting desktop clients.
I have no former experience with instant messaging. I've been reading about this lately. I've been looking mostly at things like ejabberd. But it has been a hard time and I can't find whether what I want is possible at all.
So I'd be happy if people with experience in this field could help me with some advice, articles, tales of what is possible etc.
Like frx suggested above, the StropheJS folks have an excellent book about web+xmpp coding but since you mentioned you have no experience in this type of coding I would suggest talking to some folks who have :) It will save you time in the long run - not that I'm saying don't try to implement what frx outlines, it could be a fun project :)
I know of one group who has implemented something similar and chatting with them would help solidify what you have in mind: http://andyet.net/ (I'm not affiliated with them at all except for the fact that the XMPP dev community is small and we tend to know each other :)
All goals could be achieved with ejabberd, strophe and little server side scripting
When someone gets assigned to task, server side script could easily authenticate to xmpp server and send message stanza to assigned JID. That its trivial task.
To group different people in groups, it is easily can be done from web chat app if those user properties are stored somewhere. Just join them in particular multi user chat room after authentication.
Ejabberd has option to automatically create and destroy rooms.
Ejabberd has various authorization methods including database and script auth
You could take look at StropheJS library, they have great book (paperback) released. Really recommend to read this book http://professionalxmpp.com/

Categories