Skip to content

Instantly share code, notes, and snippets.

View andresmachado's full-sized avatar

Andre Machado andresmachado

View GitHub Profile
#!/usr/bin/python3
from urllib.request import Request, urlopen
busca = input('O que deseja buscar? :')
headers = {'User-Agent': 'Mozilla/5.0'}
url = Request('http://www.google.com.br/search?q=' + busca, headers=headers)
response = urlopen(url).read()
response = response.decode('utf8')
class TenantFormMixin(object):
def get_context_data(self, *args, **kwargs):
context = super(TenantFormMixin, self).get_context_data(**kwargs)
context['tenant_form'] = TenantForm(prefix='tenant')
return context
def create_tenant_form(self, request, *args, **kwargs):
estate = get_object_or_404(Property, pk=self.kwargs['estate_id'])
self.tenant_form = TenantForm(self.request.POST, prefix='tenant')
if self.tenant_form.is_valid():
import sys
def count_words(text_file):
file = open(textfile,'r+')
word_list = {}
for word in file.read().split():
if word not in word_list:
word_list[word] = 1
else:
@andresmachado
andresmachado / Weather APP by Andre Machado.markdown
Last active September 1, 2015 16:40
Weather APP by Andre Machado
@andresmachado
andresmachado / Random Quote Generator App.markdown
Last active September 1, 2015 16:55
Random Quote Generator App