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 urllib.request | |
import json | |
from pprint import pprint | |
url = 'https://graph.facebook.com/fmasanori' | |
resp = urllib.request.urlopen(url).read() | |
data = json.loads(resp.decode('utf-8')) | |
pprint (data) | |
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 urllib.request | |
import json | |
user = 'fmasanori' | |
url = 'https://graph.facebook.com/'+user+'/picture?type=large' | |
figura = urllib.request.urlopen(url).read() | |
arquivo = user + '.jpg' | |
f = open (arquivo, 'wb') | |
f.write(figura) |
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 urllib.request import Request, urlopen | |
import json | |
req = Request( | |
url='https://api.chucknorris.io/jokes/random', | |
headers={'User-Agent': 'Mozilla/5.0'} | |
) | |
resp = urlopen(req).read() | |
data = json.loads(resp.decode('utf-8')) |
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
#models.py | |
class Task(models.Model): | |
title = models.CharField(max_length=255) | |
description = models.TextField() | |
def __unicode__(self): | |
return self.title | |
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 django.forms import ModelForm | |
from django.forms.models import inlineformset_factory | |
from models import Sponsor, Sponsorship | |
class SponsorForm(ModelForm): | |
class Meta: | |
model = Sponsor |
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
# coding=utf-8 | |
""" | |
NAO FUNCIONA MAIS. O sistema de CAPTCHA foi trocado. | |
**Implementa um Webcrawler para extracao de dados da pesquisa de media de precos realizada periodicamente pela ANP** | |
Desenvolvido por Fabio C. Barrionuevo da Luz. - 2013 | |
Simple crawler to ANP site | |
Copyright (C) 2013 Fabio C. Barrionuevo da Luz. | |
This program is free software; you can redistribute it and/or | |
modify it under the terms of the GNU General Public License |
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
# coding: utf-8 | |
def cpf_checksum(value): | |
""" | |
CPF Checksum algorithm. | |
""" | |
def dv(partial): | |
s = sum(b * int(v) for b, v in zip(range(len(partial)+1, 1, -1), partial)) | |
return s % 11 |
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
#!/usr/bin/env python | |
# post-receive hook for git-based deployments | |
import sys | |
import os | |
from subprocess import call | |
# configuration | |
deploy_to_path = '/path/to/deploy/directory/' | |
deploy_branch = 'master' |
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 django.contrib.gis.geos import GEOSGeometry | |
# sample data | |
geom_1 = GEOSGeometry('POLYGON((-71.8 42.1,-70.6 42.1,-70.5 41.2,-71.8 41.2,-71.8 42.1))') | |
geom_2 = GEOSGeometry('POLYGON((-71.12 42.23,-71.48 42.34,-71.52 42.55,-71.12 42.23))') | |
geom_3 = GEOSGeometry('POLYGON((-73.12 42.23,-71.48 42.34,-71.52 42.55,-73.12 42.23))') | |
polygons = [geom_1, geom_2, geom_3] | |
# get first polygon | |
polygon_union = polygons[0] |
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
table[name="pepe"]>thead>tr>th*3^^+tbody>tr*7>td{Basico}*3 |
OlderNewer