uptoken 是由PutPolicy经过编码加密得到的,语义如下
| 字段 | 类型 | 语义 |
|---|---|---|
| scope | string | 指定为bucket:key这样的形式,bucket必须 |
| deadline | int | token失效的unix时间戳(单位:秒),必须 |
| # to install the latest stable version: | |
| brew install scala --with-docs | |
| # to install scala-2.10.0-RC1: | |
| brew install https://raw.github.com/gist/3939012/scala.rb --with-docs | |
| # to switch versions (from https://github.com/mxcl/homebrew/wiki/External-Commands): | |
| brew switch scala 2.9.2 | |
| brew switch scala 2.10.0-RC1 |
| package main | |
| import ( | |
| "encoding/base64" | |
| "fmt" | |
| "io/ioutil" | |
| "net/http" | |
| gourl "net/url" | |
| "qbox.us/api" | |
| "qbox.us/digest_auth" |
| # -*- coding: utf-8 -*- | |
| import os | |
| import sys | |
| import StringIO | |
| # @gist import_io | |
| import qiniu.io | |
| # @endgist | |
| import qiniu.conf | |
| # @gist import_rs |
| # -*- coding: utf-8 -*- | |
| import os | |
| import sys | |
| import StringIO | |
| sys.path.append("/Users/ikbear/Code/Qiniu/SDK/python-sdk/") | |
| # @gist import_io | |
| import qiniu.io | |
| # @endgist | |
| import qiniu.conf |
| class PutPolicy | |
| include Utils | |
| attr_accessor :scope, :callback_url, :callback_body, :return_url, :return_body, :async_ops, :end_user, :expires, :save_key, :persistent_ops, :persistent_notify_url | |
| def initialize(opts = {}) | |
| @scope = opts[:scope] | |
| @callback_url = opts[:callback_url] | |
| @callback_body = opts[:callback_body] |
| # -*- encoding: utf-8 -*- | |
| require "qiniu/conf" | |
| require "qiniu/rpc" | |
| module Qiniu | |
| module Rsf | |
| class Client |
Why Should I Care (For Developers)
"Docker interests me because it allows simple environment isolation and repeatability. I can create a run-time environment once, package it up, then run it again on any other machine. Furthermore, everything that runs in that environment is isolated from the underlying host (much like a virtual machine). And best of all, everything is fast and simple."
| require 'hmac-sha1' | |
| require 'uri' | |
| require 'base64' | |
| def urlsafe_base64_encode(content) | |
| Base64.encode64(content).strip.gsub('+', '-').gsub('/','_').gsub(/\r?\n/, '') | |
| end | |
| def generate_access_token(access_key, secret_key, url, body) | |
| uri = URI.parse(url) |
| <?php | |
| require_once("../../qiniu/http.php"); | |
| require_once("../../qiniu/auth_digest.php"); | |
| require_once("../../qiniu/utils.php"); | |
| $accessKey = "aW6EvpZBvWr5Qq3HiFCLiCmvkJORHN8oE-vKR8-z"; | |
| $secretKey = "8T270kMZuVZHRjLt6ACKdXj3VAAwPbmeOykQdmOA"; | |
| $bucket = "kouqiangzhongzhi"; |