我已经解决了几个关于 Python 和 bzip2 的 StackOverflow 问题。这些对于让我进入我现在的状态非常有帮助。这是我到目前为止所做的以及我遇到的问题:
我需要 Python 2.7.3 与 bzip2 模块一起安装,以便从源代码正确编译 node.js。是的,我很抱歉,但我确实必须作为一个来自源头的普通用户来做这一切。
我已经从源代码安装了 bzip2,如下所示:
$ make -f Makefile-libbz2_so
$ make
$ make install PREFIX=${STOW}/bzip2-1.0.6
$ cp libbz2.so.1.0.6 ${STOW}/bzip2-1.0.6/lib/
$ cd ${STOW}/bzip2-1.0.6/lib
$ ln -s libbz2.so.1.0.6 libbz2.so.1.0
$ cd ${STOW}
$ stow bzip2-1.0.6
Run Code Online (Sandbox Code Playgroud)
在其他任何事情之前,我的 PATH 中都有 stow 的根目录,所以这导致:
$ bzip2 -V
# [...] Version 1.0.6
Run Code Online (Sandbox Code Playgroud)
这表明在我的 PATH 中使用了正确的 bzip2。
接下来,我继续从源代码编译 Python …
下面的simple_client.rb文件对我的仿真cas服务器工作得很好; 但是,casport.rb文件(oa-casport OmniAuth策略的主文件)没有正确设置或传递头文件/格式.它需要动态分配给类,以允许初始化程序选项能够创建它们,但我不知道除了我在这里尝试这样做之外还有什么其他方法.我相当确定我在某些时候有这个工作,但我看不出任何其他解释为什么这不起作用,因为客户端文件的简单性.
在弄清楚如何在我的Casport类中动态地设置HTTParty format和headers设置时,非常感谢任何帮助.因为它只是继续返回该特定用户的HTML视图.
simple_client.rb:
### simple_client.rb - works properly w/ parsed XML response
### The cas.dev project is coming from this Github repo:
### https://github.com/stevenhaddox/oa-casport-server
require 'rubygems'
require 'httparty'
require 'awesome_print'
class Casport
include HTTParty
base_uri 'cas.dev/users'
format :xml
headers 'Accept' => 'application/xml'
def self.find_user(id)
get("/#{id}").parsed_response
end
end
user = Casport.find_user(1)
ap user
Run Code Online (Sandbox Code Playgroud)
casport.rb:
# lib/omniauth/strategies/casport.rb
require 'omniauth/core'
require 'httparty'
require 'redis'
require 'uri'
module OmniAuth
module Strategies
#
# Authentication to CASPORT
#
# …Run Code Online (Sandbox Code Playgroud) bzip2 ×1
header ×1
httparty ×1
node.js ×1
parameters ×1
python ×1
python-2.7 ×1
ruby ×1
xml ×1