是否urllib2支持DELETE或PUT方法?如果是,请提供任何示例.我需要使用活塞API.
我有一个名为mongoose.1的mongoose web服务器的手册页,作为make和make install命令的结果,在我的ubuntu 12.04上安装了mongoose web服务器.但是,手册页条目不在手册页数据库中.
当我这样做时,在我的命令行输出:"man mongoose"
akshay@akshay-Inspiron-N5010:~/mongoose$ man mongoose
No manual entry for mongoose
See 'man 7 undocumented' for help when manual pages are not available.
Run Code Online (Sandbox Code Playgroud)
我知道存储它们的所有手册页的路径是: -
/usr/local/share/man/
Run Code Online (Sandbox Code Playgroud)
我提前感谢你的回答.
我正在使用OpenStack的REST API来实现启动或停止服务器的编程.
API参考的链接是http://api.openstack.org/api-ref.html#ext-os-server-start-stop 这需要python中的字典如下:
dict = {
os-start:null
}
Run Code Online (Sandbox Code Playgroud)
然后我正在做一个json.dumps(dict)并向openstack的nova模块的公共URL发出请求.
当我运行此程序时,未知全局名称"null"的错误.因此,它不起作用.
我想知道在OpenStack上启动服务器的这个请求是否有效,我应该在请求JSON中使用什么作为字段"os-start"的值.
如果需要任何其他信息,请与我们联系.
先感谢您.
简介: - (GCC版本4.6.3,OS-Ubuntu 12.04,解决mongoose Web服务器程序,所以当我运行"make"命令来编译和安装mongoose时,它完成了任务很好).
[问题的第1部分] 这个问题是关于stackowerflow的这篇文章.
Valenok通过提供hello示例程序的链接回复了这篇文章.
基本上,我正在尝试编译此链接上给出的示例hello程序代码: -
http://code.google.com/p/mongoose/source/browse/examples/hello.c
并将此代码放在已编译的mongoose目录中.(目录有mongoose.h文件)
以下是我编译hello程序的命令行输出.
akshay@akshay-Inspiron-N5010:~$ gcc mongoose/hello.c -o mongoose/hello
/tmp/ccroC5Z6.o: In function `callback':
hello.c:(.text+0x32): undefined reference to `mg_get_request_info'
hello.c:(.text+0x96): undefined reference to `mg_printf'
/tmp/ccroC5Z6.o: In function `main':
hello.c:(.text+0xee): undefined reference to `mg_start'
hello.c:(.text+0x103): undefined reference to `mg_stop'
collect2: ld returned 1 exit status
akshay@akshay-Inspiron-N5010:~$
Run Code Online (Sandbox Code Playgroud)
[问题的第2部分]
现在,我在mongoose.c文件中找到mg_stop,mg_start,mg_printf和mg_get_request_info的实现,因此我使用-c选项编译mongoose.c文件:gcc -c -o mongoose.o mongoose.c
我想我的问题类似于: -
但是当我在gcc上链接libmongoose.so和-L选项时,我得到以下错误: - (libmongoose.so存在于同一目录中,我的cwd)
akshay@akshay-Inspiron-N5010:~/mongoose$ gcc -L libmongoose.so -o hello hello.o mongoose.o
mongoose.o: In function `mg_start_thread':
mongoose.c:(.text+0x1369): …Run Code Online (Sandbox Code Playgroud) #include <stdio.h>
#include <unistd.h>
int main (){
while(1){
fprintf (stdout,"hello-out");
fprintf (stderr,"hello-err");
sleep (1);
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
好吧,我认为这只是打印,你好 - 然后你好 - 错误地休息一下并再次打印那些文字,但不,奇怪的事情正在发生,它只是打印hello-err然后需要一秒休息并做同样的事情再次.为什么?
但是等等,然后我决定在不同的行上打印它们,现在它起作用了.
fprintf (stdout,"hello-out\n");
fprintf (stderr,"hello-err\n");
Run Code Online (Sandbox Code Playgroud)
- - - - - 与...一样 - - - - - -
fprintf (stdout,"hello-out\n");
fprintf (stderr,"hello-err");
Run Code Online (Sandbox Code Playgroud)
那么'\n'在这里的重要性是什么?这与潮红有关吗?因为我读到'\n'用于冲洗.
并且还在stdout上打印文字,不会产生任何输出:(
fprintf (stdout,"hello-out");
fprintf (stdout,"hello-err");
Run Code Online (Sandbox Code Playgroud)
为什么?