Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

Wednesday, July 30, 2014

POP and IMAP Python email parsing;

After some investigation and coding with these methot I found that IMAP is the preffered solution to do searches and actions (like marking as read), you can do that with POP but after downloading the INBOX, and then you have to unravel the result, using REGEX for example, interpret etc.
with IMAP  (https://docs.python.org/2/library/imaplib.html) you have handy all the RTFC email commands.

The code I made can be used as an example of a simple email client reader and filterer:
https://github.com/RafaelOrtiz/imap-pop, that is a request of some forum users and programmers.



Wednesday, May 28, 2014

Python-Msql connection

I've gathered some python-mysql simple connection scripts on:

https://github.com/RafaelOrtiz/python-mysqlcon

You can desing a mysql db with the available graphic tools and then use these kind of scripts, purpose can be simple apps or tests.



Tuesday, December 10, 2013

Tastypie filtering

Tastypie is a django restful api

Here is a little recipe to show only the last resource of eache model exposed as WS:



class RequestResource (ModelResource):
    """ Request webservice
    """
    class Meta:
        queryset1 = Request.objects.order_by('-id')
        queryset = queryset1.all()[:1]
        resource_name = 'requestresource'
        authorization = Authorization()

Another recipe to show also a foreing key in a given resource:

class EmployeeResource (ModelResource):
    """ Employee webservice
    """
    user = fields.ForeignKey(UserResource,'user',full=True,null=False,blank=False)

    class Meta:
        queryset = Employee.objects.all()
        resource_name = 'employeeresource'
        authorization = Authorization()