This file contains 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 django.conf import settings | |
from django.http import Http404 | |
class MeuMiddleware(object): | |
def process_request(self, request): | |
if request.META["REMOTE_ADDR"] in settings.IPS_PERMITIDOS: | |
pass | |
else: | |
raise Http404 |
This file contains 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
# -*- coding: utf-8 -*- | |
import rethinkdb as r | |
class RethinkdbPipeline(object): | |
conn = None | |
rethinkdb_settings = {} |
This file contains 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
# -*- coding: utf-8 -*- | |
import scrapy | |
class OlxSpider(scrapy.Spider): | |
name = "olx" | |
allowed_domains = ["pe.olx.com.br"] | |
start_urls = ( | |
'http://pe.olx.com.br/imoveis/aluguel', | |
) |
This file contains 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
# -*- coding: utf-8 -*- | |
import scrapy | |
class OlxSpider(scrapy.Spider): | |
name = "olx" | |
allowed_domains = ["pe.olx.com.br"] | |
start_urls = ( | |
'http://pe.olx.com.br/imoveis/aluguel', | |
) |
This file contains 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
# -*- coding: utf-8 -*- | |
import scrapy | |
class OlxSpider(scrapy.Spider): | |
name = "olx" | |
allowed_domains = ["pe.olx.com.br"] | |
start_urls = ( | |
'http://pe.olx.com.br/imoveis/aluguel', | |
) |
This file contains 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
# -*- coding: utf-8 -*- | |
import scrapy | |
class OlxSpider(scrapy.Spider): | |
name = "olx" | |
allowed_domains = ["pe.olx.com.br"] | |
start_urls = ( | |
'http://pe.olx.com.br/imoveis/aluguel', | |
) |
This file contains 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
# -*- coding: utf-8 -*- | |
import scrapy | |
class GilenoFilhoSpider(scrapy.Spider): | |
name = "gilenofilho" | |
allowed_domains = ["gilenofilho.com.br"] | |
def starts_requests(self): |
This file contains 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
# -*- coding: utf-8 -*- | |
import scrapy | |
class GilenoFilhoSpider(scrapy.Spider): | |
name = "gilenofilho" | |
allowed_domains = ["gilenofilho.com.br"] | |
start_urls = ( | |
'http://www.gilenofilho.com.br/', |
This file contains 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 django import forms | |
class MeuForm(forms.Form): | |
meu_campo = forms.CharField( | |
error_messages={'required': 'Este campo de ser preenchido'} | |
) | |
meu_campo2 = forms.IntegerField( | |
error_messages={'required': 'Este campo de ser preenchido', 'invalid': 'Informe um número válido'} |
This file contains 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 reportlab.pdfgen import canvas | |
from reportlab.lib.units import inch | |
c = canvas.Canvas("hello.pdf") | |
c.setFont("Helvetica", 40) | |
c.drawString(3*inch, 3*inch, "Hello World") | |
c.showPage() | |
c.save() |