Skip to content

Instantly share code, notes, and snippets.

0 errors found
Django version 1.4.2, using settings 'opass.settings'
Development server is running at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
Method: POST
Path: /
Data: Action=GetSendQuota
Headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}
Host: email.us-east-1.amazonaws.com
establishing HTTPS connection: host=email.us-east-1.amazonaws.com, kwargs={}
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from ..items import WikiItem
from scrapy.http import Request
import urlparse
class DmozSpider(BaseSpider):
name = "wiki"
allowed_domains = ["wikipedia.org"]
start_urls = [
from __future__ import print_function
import threading
import time
ending = False
def response():
while not ending:
print('.')
time.sleep(1)
def fib(num):
@timtan
timtan / outof_expection.py
Created March 26, 2013 10:44
a basic example which will raise exception
__author__ = 'tim'
def is_even_number(number):
return number % 2 == 0
is_even_number('2')
@timtan
timtan / try_except.py
Created March 26, 2013 11:08
counter with try exception style
__author__ = 'tim'
fruits = [
'apple', 'pineapple',
'apple', 'pineapple',
'apple', 'pineapple',
]
counter = {}
@timtan
timtan / file_not_found2.py
Created March 26, 2013 11:18
get content no matter the file exists
__author__ = 'tim'
def read_content(name): # just print an message indicate error
'''
it is of if the file is not exist
'''
try:
fs = open(name)
print "coder after error will not printed"
@timtan
timtan / handle_more_exception.py
Created March 26, 2013 11:40
handle two type of error
__author__ = 'tim'
def a_lot_exception(a,b):
try:
x = 3/a
y = int(b,8)
return x + y
except ZeroDivisionError:
return 0
except ValueError:
return x
__author__ = 'tim'
fruits = [
'apple', 'pineapple',
'apple', 'pineapple',
'apple', 'pineapple',
]
counter = {}
for fruit in fruits:
if fruit in counter:
counter[fruit] +=1
__author__ = 'tim'
fruits = [
'apple', 'pineapple',
'apple', 'pineapple',
'apple', 'pineapple',
]
counter = {}
for fruit in fruits:
if fruit in counter:
counter[fruit] +=1
##Reference
## http://effbot.org/tkinterbook/label.htm
import Tkinter
root = Tkinter.Tk()
variable = Tkinter.StringVar()
variable.set('0')
def add():
variable.set(int(variable.get()) + 1)