我如何使用RestClient进行基本身份验证? [英] How do I do basic authentication with RestClient?

查看:167
本文介绍了我如何使用RestClient进行基本身份验证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何使用 RestClient 进行基本身份验证吗?



我需要通过其RESTful API在GitHub上创建一个私有存储库。

看起来像你可以只需将用户名和密码指定为请求对象的一部分即可。



你试过类似的东西:

  r = Request.new ({:user =>username,:password =>password})

另外,如果您在 ReadMe 的外壳部分查看它,它有一个指定它的示例作为 restshell 的一部分。

  $ restclient https://example.com使用者传票
>>删除'/ private / resource'


Does anyone know how to do basic authentication with RestClient?

I need to create a private repository on GitHub through their RESTful API.

解决方案

From the source it looks like you can just specify user and password as part of your request object.

Have you tried something like:

r = Request.new({:user => "username", :password => "password"})

Also if you look down in the Shell section of the ReadMe it has an example of specifying it as part of restshell.

$ restclient https://example.com user pass
>> delete '/private/resource'

这篇关于我如何使用RestClient进行基本身份验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆