标签: rest-client

在python中对neo4j中的节点建立索引

我正在使用标记节点和url节点构建数据库,并且url节点连接到标记节点.在这种情况下,如果将相同的URL插入到数据库中,则应该链接到标记节点,而不是创建重复的url节点.我认为索引可以解决这个问题.如何使用neo4jrestclient进行索引和遍历?链接到教程会很好.我目前正在使用versae neo4jrestclient.

谢谢

python neo4j rest-client

2
推荐指数
1
解决办法
1296
查看次数

在firefox中向Rest Client发送帖子请求

我在firefox web浏览器中使用Rest Client添加.我想测试处理HTTP POST请求并使用json 的Web服务.如何使用Rest Client进行测试?

如果我在请求正文中放了一个json,我会收到*HTTP 415 Unsupported Media Type错误*.

这样做的正确方法是什么?

post http rest-client

2
推荐指数
1
解决办法
3026
查看次数

如何查看来自 HTTParty get 请求的响应 cookie?

我正在使用httparty向某个网站发出 GET 请求。我需要响应 cookie 才能成功发出登录请求。

rest_client 让它变得非常简单,我所要做的就是:

get_request = RestClient.get('<REDACTED>')
response_cookies = get_request.cookies

# => 
{
 "sessiontype"=>"mpb",
 "aac"=>"741F9EC20A4C422369F7564445611591",
 "Expires"=>"Sun",
 "Path"=>"%2F",
 "Domain"=>"<REDACTED>",
 "internetbankierenmi"=>"1559079104.20480.0000",
 "TSdb640d"=>"d17ca2538ee2215b647c3466d4b06da7ec33c7a21dc7217953d3ffe7d4efbe89959deba9debace3f579e71c9e27e0b6b1ea2c663"
}
Run Code Online (Sandbox Code Playgroud)

但我想对 httparty 做同样的事情。所以我的问题是如何在 httparty 中查看/访问来自 GET 请求的响应 cookie?

ruby httparty rest-client

2
推荐指数
1
解决办法
5500
查看次数

将数据字段添加到 Ruby 中的休息客户端请求

我在使用 rest-client gem 向 uber api 发出请求时遇到问题。我认为问题在于我试图将所需的信息作为 url 中的参数而不是数据字段传递。示例 curl 请求在 之后具有该参数-d,但我不知道如何使用 rest-client 实现它。谢谢您的帮助。

此请求在控制台中工作:

curl -v -H "Authorization: Bearer " + session[:request_token] \
     -H "Content-Type: application/json" -X POST -d \ '{"start_latitude":"37.334381","start_longitude":"-121.89432","end_latitude":"37.77703","end_longitude":"-122.419571","product_id":"a1111c8c-c720-46c3-8534-2fcdd730040d"}' \
https://sandbox-api.uber.com/v1/requests
Run Code Online (Sandbox Code Playgroud)

来自我的控制器的请求得到 406 错误,不可接受的响应。

@uber_ride = JSON.load(RestClient::Request.execute(
  :method => :post,
  :url => "https://sandbox-api.uber.com/v1/sandbox/requests/product_id=#{@uberx_id}?start_latitude=#{lat_start}&start_longitude=#{lng_start}&end_latitude=#{lat_end}&end_longitude=#{lng_end}",
  :headers => {'Authorization' => 'Bearer ' + session[:request_token], 'content_type' => 'application/json'}
))  
Run Code Online (Sandbox Code Playgroud)

我尝试添加一个额外的字段,data但会出现 404 Resource Not Found 错误。

@uber_ride = JSON.load(RestClient::Request.execute(
  :method => :post,
  :url => "https://sandbox-api.uber.com/v1/sandbox/requests/",
  :data => {'start_latitude' …
Run Code Online (Sandbox Code Playgroud)

ruby rest-client uber-api

2
推荐指数
1
解决办法
4546
查看次数

如何在Spring Boot项目中忽略特定URL的Spring Security CSRF

如何忽略特定URL的CSRF安全性,例如“ / workflow / **”。除了该URL,我还需要所有URL和方法的授权和CSRF安全。

@Configuration
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
protected static class SecurityConfiguration extends WebSecurityConfigurerAdapter {

    @Autowired
    private RESTAuthenticationEntryPoint authenticationEntryPoint;

    @Autowired
    private RESTAuthenticationFailureHandler authenticationFailureHandler;

    @Autowired
    private RESTAuthenticationSuccessHandler authenticationSuccessHandler;

    @Autowired
    private PranaUserDetailsService userDetailsService;

    @Override
    protected void configure(HttpSecurity http) throws Exception {

        http.csrf().requireCsrfProtectionMatcher(new AllExceptUrlStartedWith("/workflow"))          
        .and().authorizeRequests()
        .antMatchers("/rest/**", "/tasklist").authenticated()
        .and().logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
        .logoutSuccessUrl("/index.html")        
        .and().exceptionHandling().authenticationEntryPoint(authenticationEntryPoint)
        .and().formLogin().successHandler(authenticationSuccessHandler)
        .and().formLogin().failureHandler(authenticationFailureHandler)         
        .and().csrf().csrfTokenRepository(csrfTokenRepository()).and().addFilterAfter(new CsrfHeaderFilter(), CsrfFilter.class);
    }

    private static class AllExceptUrlStartedWith implements RequestMatcher {

        private static final String[] ALLOWED_METHODS =
                new String[] {"GET"};

        private final String[] allowedUrls;

        public AllExceptUrlStartedWith(String... allowedUrls) {
            this.allowedUrls = allowedUrls; …
Run Code Online (Sandbox Code Playgroud)

java csrf spring-security rest-client spring-boot

2
推荐指数
1
解决办法
2223
查看次数

如何为外部世界REST服务创建REST客户端

如何使用JAX-RS Client流畅的API为外部世界REST服务创建休息客户端?

例如,假设服务返回具有两个字段名称和年龄的人物对象.

无论我遇到什么示例/教程,它们都会执行与下面代码段相同的操作,或者他们在同一个项目中开发客户端,以便用person.class替换String.class.我应该如何创建独立的客户端,让我回归人.

String entity = client.target("http://example.com/rest")
        .path("resource/helloworld")
        .queryParam("greeting", "Hi World!")
        .request(MediaType.TEXT_PLAIN_TYPE)
        .header("some-header", "true")
        .get(String.class);
Run Code Online (Sandbox Code Playgroud)

java jax-rs rest-client

2
推荐指数
1
解决办法
4771
查看次数

如何使用 Aerospike Rest 客户端插入 GEOJSON

使用以下查询成功插入一条记录:

INSERT INTO test.geoPSGC (PK,PSGC,NAME,COORDINATES) VALUES ("PH042103059","PH042103059","P.F. ESPIRITU VIII", GEOJSON('{"type": "Polygon", "coordinates": [[[120.963819085,14.4360609570001],[120.963508642,14.437767122],[120.963132639,14.4396434060001],[120.963030111,14.4401597790001],[120.962205408,14.4399052410001],[120.960393097,14.439447073],[120.960260737,14.4401495980001],[120.96018129,14.440132872],[120.959486942,14.439986693],[120.959097233,14.4411254360001],[120.959038955,14.441300109],[120.960790176,14.441788822],[120.960572028,14.4424181910001],[120.959700188,14.4445419810001],[120.960098399,14.4447199690001],[120.960774416,14.4450736870001],[120.960692088,14.4452229070001],[120.960470831,14.4456654210001],[120.960321611,14.445969007],[120.958550232,14.4448707610001],[120.958129094,14.443015749],[120.955905609,14.4426806610001],[120.955608883,14.443570838],[120.955346395,14.4434795380001],[120.955289332,14.4437420260001],[120.954969781,14.443696376],[120.954889894,14.4440045150001],[120.954225114,14.443719201],[120.953954066,14.443696376],[120.952336035,14.444176962],[120.952255088,14.443998277],[120.953521745,14.443688057],[120.953902021,14.4424971950001],[120.954722615,14.442737369],[120.954912753,14.4421769630001],[120.955873449,14.442287043],[120.956533927,14.440325622],[120.956223702,14.440255571],[120.95590347,14.440245564],[120.955142919,14.4402956],[120.954782659,14.440255571],[120.954332332,14.4400954550001],[120.954452419,14.439054701],[120.953801948,14.438904592],[120.952911303,14.438774498],[120.952965697,14.438500543],[120.952985959,14.4382396770001],[120.953011179,14.4381358630001],[120.953277921,14.4369847450001],[120.953318707,14.4368087330001],[120.956736645,14.436828264],[120.956768379,14.4362091220001],[120.956779247,14.435895783],[120.956804391,14.4355445270001],[120.956772893,14.435371087],[120.956809539,14.4351651270001],[120.956836543,14.434532458],[120.956863741,14.4340464310001],[120.956467101,14.4338641910001],[120.9557208,14.4338163350001],[120.955738353,14.4330264620001],[120.955744235,14.4323139710001],[120.957669155,14.4323067990001],[120.957844682,14.4326051960001],[120.96010627,14.4329594650001],[120.961732768,14.4327991060001],[120.962557471,14.4326845640001],[120.964088989,14.4329410820001],[120.96407482,14.433125068],[120.964044954,14.433513331],[120.964071138,14.433868956],[120.964138908,14.434272455],[120.964139531,14.4343794550001],[120.963928361,14.435506225],[120.963819085,14.4360609570001]]]}'));
Run Code Online (Sandbox Code Playgroud)

但在使用 Aerospike Rest Client v1.10.4(最新)时抛出错误“无法识别的令牌‘GEOJSON’”

请求正文:

{
    "PSGC": "PH042103059",
    "NAME": "P.F. ESPIRITU VIII",
    "COORDINATES": GEOJSON('{"type": "Polygon", "coordinates": [[[120.963819085,14.4360609570001],[120.963508642,14.437767122],[120.963132639,14.4396434060001],[120.963030111,14.4401597790001],[120.962205408,14.4399052410001],[120.960393097,14.439447073],[120.960260737,14.4401495980001],[120.96018129,14.440132872],[120.959486942,14.439986693],[120.959097233,14.4411254360001],[120.959038955,14.441300109],[120.960790176,14.441788822],[120.960572028,14.4424181910001],[120.959700188,14.4445419810001],[120.960098399,14.4447199690001],[120.960774416,14.4450736870001],[120.960692088,14.4452229070001],[120.960470831,14.4456654210001],[120.960321611,14.445969007],[120.958550232,14.4448707610001],[120.958129094,14.443015749],[120.955905609,14.4426806610001],[120.955608883,14.443570838],[120.955346395,14.4434795380001],[120.955289332,14.4437420260001],[120.954969781,14.443696376],[120.954889894,14.4440045150001],[120.954225114,14.443719201],[120.953954066,14.443696376],[120.952336035,14.444176962],[120.952255088,14.443998277],[120.953521745,14.443688057],[120.953902021,14.4424971950001],[120.954722615,14.442737369],[120.954912753,14.4421769630001],[120.955873449,14.442287043],[120.956533927,14.440325622],[120.956223702,14.440255571],[120.95590347,14.440245564],[120.955142919,14.4402956],[120.954782659,14.440255571],[120.954332332,14.4400954550001],[120.954452419,14.439054701],[120.953801948,14.438904592],[120.952911303,14.438774498],[120.952965697,14.438500543],[120.952985959,14.4382396770001],[120.953011179,14.4381358630001],[120.953277921,14.4369847450001],[120.953318707,14.4368087330001],[120.956736645,14.436828264],[120.956768379,14.4362091220001],[120.956779247,14.435895783],[120.956804391,14.4355445270001],[120.956772893,14.435371087],[120.956809539,14.4351651270001],[120.956836543,14.434532458],[120.956863741,14.4340464310001],[120.956467101,14.4338641910001],[120.9557208,14.4338163350001],[120.955738353,14.4330264620001],[120.955744235,14.4323139710001],[120.957669155,14.4323067990001],[120.957844682,14.4326051960001],[120.96010627,14.4329594650001],[120.961732768,14.4327991060001],[120.962557471,14.4326845640001],[120.964088989,14.4329410820001],[120.96407482,14.433125068],[120.964044954,14.433513331],[120.964071138,14.433868956],[120.964138908,14.434272455],[120.964139531,14.4343794550001],[120.963928361,14.435506225],[120.963819085,14.4360609570001]]]}'))
}
Run Code Online (Sandbox Code Playgroud)

geojson rest-client aerospike

2
推荐指数
1
解决办法
130
查看次数

ruby rest_client异常处理

我想在Ruby中使用rest-client gem做一些HTTP REST请求,

https://github.com/rest-client/rest-client上的 readme.md之后, 我编写了这个简单的命令行脚本,尝试在响应代码不同于2xx的情况下捕获异常:

RestClient.get('http://thisurldoesnotexist/resource') { |response, request, result, &block|
case response.code
  when 200
    p "It worked !"
    response
  else
    response.return!(request, result, &block)
  end
}
Run Code Online (Sandbox Code Playgroud)

你好stdout输出:

/home/*****/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:878:in `initialize': getaddrinfo: Name or service not known (SocketError)
    from /home/solyaris/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:878:in `open'
    from /home/solyaris/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:878:in `block in connect'
    from /home/solyaris/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
    from /home/solyaris/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:877:in `connect'
    from /home/solyaris/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
    from /home/solyaris/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:851:in `start'
    from /home/solyaris/.rvm/gems/ruby-2.0.0-p247/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
    from /home/solyaris/.rvm/gems/ruby-2.0.0-p247/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
    from /home/solyaris/.rvm/gems/ruby-2.0.0-p247/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
    from /home/solyaris/.rvm/gems/ruby-2.0.0-p247/gems/rest-client-1.6.7/lib/restclient.rb:68:in `get'
    from prova_rest.rb:3:in `<main>'
Run Code Online (Sandbox Code Playgroud)

我如何捕获SocketError?哪里我错了?

谢谢乔治

ruby exception-handling rest-client

1
推荐指数
1
解决办法
2870
查看次数

ruby:将http响应代码转换为它的含义

你如何将http响应代码转换为它在ruby/rails中的含义.我尝试了(想象的).to_words方法但没有成功

(byebug) resp.code
201
(byebug) resp.code.to_words
"201 Created"
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails rest-client http-response-codes

1
推荐指数
1
解决办法
65
查看次数

如何在Chrome的Arc(高级REST客户端)扩展程序中删除已保存的请求?

如何在Chrome的ARC(高级REST客户端)扩展程序中删除已保存的请求?

我目前在chrome中安装了ARC扩展程序,并保存了一些请求。

我在寻找,但是找不到从“已保存”列表中删除请求的任何方法。

  • 试图选择请求并按Delete键(从键盘),但不起作用
  • 试图在菜单上找到一些“删除”选项,但没有找到

扩展程序链接:https : //chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo

httprequest rest-client advanced-rest-client

1
推荐指数
1
解决办法
1002
查看次数