Skip to content

Instantly share code, notes, and snippets.

@konexis
konexis / cache.py
Created February 22, 2023 03:14 — forked from leonjza/cache.py
Simple SQLite Cache
#!/usr/bin/python
import os
import errno
import sqlite3
import sys
from time import time
from cPickle import loads, dumps
import logging
@konexis
konexis / flask_deform_simpleSort.py
Created October 26, 2022 19:31 — forked from aanastasiou/flask_deform_simpleSort.py
Using Pylon's Deform with Flask
"""A very simple example to show what is required to get the excellent deform module from the Pylon's project to work with Flask.
DeForm is a Pylon's module capable of automatically creating HTML forms that conform to a schema of classes defined in Python through the Colander module. The transformation between Schema<-->Form data is handled by another module called Peppercorn. More information about how these three modules work together can be found at: http://docs.pylonsproject.org/projects/deform/en/latest/?awesome
Although DeForm is a Pylon's project, it can also operate as a stand-alone module. This Gist contains all the necessary changes to objects provided by Flask so that DeForm can serialize and deserialize data posted through a Flask.Request.
The basic thing that this gist is trying to demonstrate is how to derive from a Flask.Request object in order to change the data type of the Flask.Request.form object that stores the data posted by the client to the server. By default, Flask uses a MultiDict i
import json
class VivaReal(scrapy.Spider):
name= 'viva'
def start_requests(self):
yield scrapy.Request(url = 'https://glue-api.vivareal.com/v2/listings?addressCity=Volta%20Redonda&addressLocationId=BR%3ERio%20de%20Janeiro%3ENULL%3EVolta%20Redonda&addressNeighborhood=&addressState=Rio%20de%20Janeiro&addressCountry=Brasil&addressStreet=&addressZone=&addressPointLat=-22.507767&addressPointLon=-44.094613&business=SALE&facets=amenities&unitTypes=&unitSubTypes=&unitTypesV3=&usageTypes=&listingType=USED&parentId=null&categoryPage=RESULT&includeFields=search(result(listings(listing(displayAddressType%2Camenities%2CusableAreas%2CconstructionStatus%2ClistingType%2Cdescription%2Ctitle%2CunitTypes%2CnonActivationReason%2CpropertyType%2CunitSubTypes%2Cid%2Cportal%2CparkingSpaces%2Caddress%2Csuites%2CpublicationType%2CexternalId%2Cbathrooms%2CusageTypes%2CtotalAreas%2CadvertiserId%2Cbedrooms%2CpricingInfos%2CshowPrice%2Cstatus%2CadvertiserContact%2CvideoTourLink%2CwhatsappNumber%2Cstamps)%2Caccount(id%2Cn
Maureen Massey
Nisha Howe
Janice Beck
Gracie-Leigh Wynn
Mariam O'Quinn
Blythe Perkins
Maariyah Blevins
Leia Lutz
Janet Mckenna
Jayden-Lee Keith
import time
from datetime import date
from PIL import Image, ImageFont, ImageDraw
inicio = time.time()
with open(r'nomes_certificados.txt', 'r') as f:
nomes = f.read()
for nome in nomes.split('\n'):
coord_pessoa = (447, 452)
coord_chefe = (250, 650)
coord_data = (682, 652)
@konexis
konexis / gist:8abd25b49dc15231cd7b8f12c5d822c3
Last active October 18, 2022 19:34
Imposto de Renda - Bens e Direitos
import pyautogui
import pandas as pd
from time import sleep
df = pd.read_excel(r'diretorio da planilha')
cod_IRs = df['cod_IR']
codigo_ativos = df['codigo_ativo']
cnpj_empresas = df['cnpj_empresa']
nome_empresas = df['nome_empresa']
@konexis
konexis / auto.py
Created September 29, 2020 04:49 — forked from iann0036/auto.py
Python Input Record and Play
import pyautogui, time, sys, os, win32api, win32gui, win32con, datetime, pyHook, pythoncom
from optparse import OptionParser
'''
Python Automated Actions Script by Ian Mckay
Version 0.1 - 20151217
'''
pyautogui.PAUSE = 0
pyautogui.FAILSAFE = True
import scrapy
class MlSpider(scrapy.Spider):
name = 'ml'
start_urls = ['https://www.mercadolivre.com.br/ofertas?page=1']
def parse(self, response, **kwargs):
for i in response.xpath('//li[@class="promotion-item"]'):