This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import wx | |
from datetime import datetime | |
class Frame( wx.Frame): | |
def __init__(self): | |
wx.Frame.__init__(self,None,-1, "Probando Fecha , wx = {}".format(wx.__version__), size = ( 200,200)) | |
self.panel = wx.Panel(self, -1) | |
f = datetime.today() | |
hoy = wx.DateTimeFromDMY(f.day, f.month - 1, f.year) | |
fecha = wx.DatePickerCtrl( self.panel, -1, wx.DefaultDateTime, wx.DefaultPosition, [140,-1], wx.DP_DROPDOWN|wx.DP_ALLOWNONE ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
do ... | |
pip install boto, turbomail | |
echo "just a test" > README.txt | |
... first | |
""" | |
import sys | |
from boto import connect_ses | |
FROM = "[email protected]" | |
TO = "[email protected]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@task | |
def columns( table = "usuarios"): | |
try: | |
t = Table( table , metadata, autoload = True, autoload_with = engine) | |
try: | |
clear_mappers() # this clean all previous mappers if any | |
mapper( Dummy, t ) | |
except: | |
traceback.print_exc() | |
return "error" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from celery.task import task | |
from sqlalchemy import create_engine, MetaData, Table, Column, Integer, select | |
from sqlalchemy.orm import sessionmaker, mapper, clear_mappers | |
import traceback | |
uri = "mssql://{}:{}@{}".format("user", "password", "DSNwhatever") | |
engine = create_engine( uri ) | |
session = sessionmaker( bind = engine )() | |
metadata = MetaData() | |
gixanip_table = Table("gixanip", metadata, autoload = True, autoload_with = engine) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from celery.schedules import crontab | |
CELERY_IMPORTS = ( "tasks", ) | |
CELERY_RESULT_BACKEND = "redis" | |
REDIS_HOST = "localhost" | |
REDIS_PORT = 6379 | |
REDIS_DB = 8 | |
REDIS_CONNECT_RETRY = True | |
BROKER_BACKEND = "redis" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<style type="text/css"> | |
html { | |
font-family: "Verdana"; | |
font-size: 8px; | |
} | |
</style> | |
</head> | |
<body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, sys, subprocess | |
from mako.template import Template | |
from mako.runtime import Context | |
from cStringIO import StringIO #needed as buffer for mako | |
try: | |
from mako.util import FastEncodingBuffer #new kind of buffer that is faster ( version 0.4) than StringIO | |
except: | |
pass | |
from ho import pisa as pisa |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import boto | |
from boto.s3.connection import Location | |
# | |
# create a couple of strings with our very minimal web content | |
# | |
index_html = """ | |
<html> | |
<head><title>My S3 Webpage</title></head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def paridad_dolar_dof(dia, mes, year ): | |
""" funcion python para extraer tipo de cambio del colar | |
segun el Diario Oficial de la Federacion | |
Autor : @jdaguilera | |
""" | |
from BeautifulSoup import BeautifulSoup | |
from urllib2 import urlopen | |
url = "http://dof.gob.mx/indicadores_detalle.php?cod_tipo_indicador=158&dfecha={0:02d}%2F{1:02d}%2F{2}&hfecha={0:02d}%2F{1:02d}%2F{2}".format( dia, mes, year) | |
contents = urlopen(url).read() | |
soup = BeautifulSoup( contents ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def paridad_dolar_dof(dia, mes, year ): | |
from BeautifulSoup import BeautifulSoup | |
from urllib2 import urlopen | |
url = "http://dof.gob.mx/indicadores_detalle.php?cod_tipo_indicador=158&dfecha={0:02d}%2F{1:02d}%2F{2}&hfecha={0:02d}%2F{1:02d}%2F{2}".format( dia, mes, year) | |
contents = urlopen(url).read() | |
soup = BeautifulSoup( contents ) | |
first = soup.find("tr", "Celda 1 ") | |
second = first.findAll("td") | |
return second[-1].renderContents() |