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 urlparse | |
URLscheme = "http" | |
URLlocation = "www.python.org" | |
URLpath = "lib/module-urlparse.html" | |
modList = ("urllib", "urllib2", "httplib", "cgilib") |
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 httplib, json | |
class CityCode(object): | |
#将城市代码存入字典中 | |
valid_code = { | |
101010300: '朝阳', | |
101011000: '石景山', | |
101010900: '丰台' |
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 urllib2 | |
import urllib | |
import json | |
import httplib | |
def savefile(filename,data): | |
fdata = open(filename,'wb') | |
fdata.write(data) | |
fdata.close |
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
import sys | |
import httplib | |
from httplib import HTTPException | |
import json | |
DEBUG = False | |
BOUNDARY = '--------Boundary' | |
def post_stuff(host, post_url, field_dict): |
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
#!/usr/bin/python | |
# - * - coding: UTF-8 - * - | |
import json | |
import urllib | |
import oauth2 as oauth | |
# 此行用于获取 CONSUMER_KEY、CONSUMER_SECRET 等常数 | |
from config import * | |
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
class Selenium2TestCase(TestCase): | |
def report_pass_fail(self): | |
base64string = base64.encodestring('%s:%s' % (config['username'], | |
config['access-key']))[:-1] | |
result = json.dumps({'passed': self._exc_info() == (None, None, None)}) | |
connection = httplib.HTTPConnection(self.config['host']) | |
connection.request('PUT', '/rest/v1/%s/jobs/%s' % (self.config['username'], | |
self.driver.session_id), | |
result, |
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
import base64, httplib, json, xmlrpclib | |
class ApiBase(object): | |
def __init__(self, host, login, password, port=10000, https=True): | |
self.host = host | |
self.login = login | |
self.password = password | |
self.port = port | |
self.https = https | |
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
import sys | |
import BaseHTTPServer | |
from BaseHTTPServer import BaseHTTPRequestHandler | |
from urlparse import parse_qs | |
import httplib, urllib | |
import json | |
PARAMS_STRING = "?redirect_uri=http://127.0.0.1&client_secret=[SECRET]&client_id=[CLIENT_ID]&grant_type=authorization_code&code=" | |
class Handler(BaseHTTPRequestHandler): |
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
import httplib | |
import base64 | |
import string | |
import urllib | |
host = "api.supertweet.net" | |
url = "/1.1/statuses/update.json" | |
username = 'INPUTUSERNAME' | |
password = 'INPUTPASSWORD' | |
message = 'Tweet by Python on Raspberry Pi' |
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 | |
# Author: --<> | |
# Purpose: | |
# Created: 2013/7/3 | |
import sys | |
import httplib | |
import json | |
import urllib | |
NewerOlder