我的Python软件包有一个setup.py
可以在Ubuntu Trusty上本地构建并在一个新的Vagrant Ubuntu Trusty VM上构建,当我像这样配置它时:
sudo apt-get install python python-dev --force-yes --assume-yes --fix-broken
curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | sudo python2.7
sudo -H pip install setuptools wheel virtualenv --upgrade
Run Code Online (Sandbox Code Playgroud)
但是当我在Travis CI Trusty Beta VM上做同样的事情时:
- sudo apt-get install python python-dev --force-yes --assume-yes --fix-broken
- curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | sudo python2.7
- sudo -H pip install setuptools wheel virtualenv --upgrade
Run Code Online (Sandbox Code Playgroud)
我明白了:
python2.7 setup.py bdist_wheel
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help …
Run Code Online (Sandbox Code Playgroud) 我使用优秀的websocketpp库在C++应用程序中提供Websockets(和HTTP)服务器.我还需要在同一个应用程序中的HTTP客户端连接到REST API.我也一直在websocketpp尝试这个,但到目前为止我没有成功.以下初步尝试为我提供了这个日志输出:
[2015-03-06 18:01:18] [connect] Successful connection
[2015-03-06 18:01:18] [error] Server handshake response error: websocketpp.processor:20 (Invalid HTTP status.)
[2015-03-06 18:01:18] [disconnect] Failed: Invalid HTTP status.
Run Code Online (Sandbox Code Playgroud)
这表明我的http_
处理程序方法可能需要更多.任何意见,将不胜感激.websocketpp文档和示例似乎不包含简单的HTTP客户端.
#define _WEBSOCKETPP_CPP11_STL_
#include <websocketpp/config/asio_client.hpp>
#include <websocketpp/client.hpp>
#include <websocketpp/common/thread.hpp>
namespace {
using namespace websocketpp;
typedef client<websocketpp::config::asio_client> client;
class Client {
public:
Client(void){
client_.init_asio();
client_.set_http_handler(bind(&Client::http_,this,_1));
}
std::string get(const std::string& url) {
websocketpp::lib::error_code error;
client::connection_ptr con = client_.get_connection(url,error);
if(error) std::runtime_error("Unable to connnect.\n url: "+url+"\n message: "+error.message());
client_.connect(con);
websocketpp::lib::thread asio_thread(&client::run, &client_);
asio_thread.join();
return data_; …
Run Code Online (Sandbox Code Playgroud)