通过casablanca库与github API交互
Interacting with github API through casablanca library
我正在MFC框架中构建Git客户端,我正在使用casablanca库来连接github服务器并使用其API。在Github教程中,有一个示例显示了如何向Github服务器发送请求,并附上用户名和密码以进行身份验证:
https://developer.github.com/v3/#authentication
curl -i https://api.github.com -u valid_username:valid_password
现在,我试着用微软的casablanca来达到同样的效果,但我根本无法获得正确的语法:
http_client client(U("https://api.github.com/users/myuser"));
uri_builder builder(U("- u myuser:mypass"));
pplx::task<http_response> requestTask = client.request(methods::GET, builder.to_string());
在调用这个之后,我收到了卡萨布兰卡抛出的异常,说uri无效
知道如何在casablanca中正确构建请求,以便将其发送到github服务器吗
非常感谢。
在GitHub页面上的示例中,-u username:password
是卷曲的选项:
-u/--user <user:password>
Specify the user name and password to use for server authentication.
您可以使用http_client_config::set_credentials()
使用C++REST SDK执行基本身份验证。
(另请参阅相关问题:在Casablanca中设置基本HTTP身份验证)
相关文章:
- Qt VTK交互风格的信号到小部件
- 用于访问容器<T>数据成员的正确 API
- 如何使用Luacneneneba API正确读取字符串和表参数
- C++MySQL C api用户输入行
- 如何使用 AWS Transcribe C++ API 中的'StartTranscriptionJobRequest'?
- 将std::string传递给WriteConsole API
- EvtExportLogneneneba API正在将远程计算机的事件日志保存到远程PC本身.如何将其保存到主机
- Qt Quick-如何仅从c++代码与qml属性交互
- 在gtest.中使用fff.h模拟系统API
- 有没有任务栏API可以立即应用注册表更改
- C++win32 API创建多个类似视口的窗口
- 使用libcurl提交批量url的正确BING Api POST url是什么
- 如何将真正的字符串从python c-api转换为python脚本
- 使用Qt框架在c ++类中创建API调用
- Libreoffice API (UNO):需要更改用户的 xTextField 文本
- 使用 WIN32 API (C/C++) 对特定树视图项进行着色
- 为什么 wx 在这里不使用引用,wx 的 API 和端口层如何交互?
- 现代Windows输入API/用户交互API
- 通过casablanca库与github API交互
- 客户端服务器API交互