小编Muj*_*ori的帖子

改造入队不起作用,但执行工作

我正在使用com.squareup.retrofit2:retrofit:2.2.0

    HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
    logging.setLevel(HttpLoggingInterceptor.Level.BODY);

    OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
    httpClient.addInterceptor(logging);


    Retrofit retrofit = new Retrofit.Builder()
            .baseUrl("http://localhost:9000")
            .addConverterFactory(GsonConverterFactory.create())
            .client(httpClient.build())
            .build();

    final UserService service = retrofit.create(UserService.class);

    Call<User> userCall = service.createUser(user)
Run Code Online (Sandbox Code Playgroud)

这是问题所在:当我运行execute它时,它会生成REST API请求但是当我使用enqueue它时什么都不做(没有例外,没有日志)

  userCall.execute(); //this work

  //this does not work
  userCall.enqueue(new Callback<User>() {
      @Override
      public void onResponse(Call<User> call, Response<User> response) {
          // no response 
      }

      @Override
      public void onFailure(Call<User> call, Throwable t) {
          //nothing here
      }
  });
Run Code Online (Sandbox Code Playgroud)

java android http retrofit

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

为什么time.strptime("2014年9月30日","%b.%d,%Y")不起作用

我正在尝试在python中解析日期.我的代码适用于除9月以外的所有其他月份

这是我的代码

time.strptime("Sept. 30, 2014", "%b. %d, %Y")
Run Code Online (Sandbox Code Playgroud)

我收到这个错误

ValueError: time data 'Sept. 30, 2014' does not match format '%b. %d, %Y'
Run Code Online (Sandbox Code Playgroud)

python datetime

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

标签 统计

android ×1

datetime ×1

http ×1

java ×1

python ×1

retrofit ×1