我有一个现有的nodejs和快速的购物车API。我想把这个API和react-admin集成起来。。我已经将以下代码添加到app.js文件中,以便从数据库加载类别。
// in src/App.js
import React from 'react';
import { Admin, Resource } from 'react-admin';
import restProvider from 'ra-data-simple-rest';
import { CategoriesList } from './categories'
在使用tweepy和游标时,可以从Twitter获取HTTP响应头的值吗?
我想知道我的应用程序当前的API剩余速率限制,它应该在头中返回,如Twitter API 中所述(x速率限制剩余:为15分钟窗口留下的请求数量)。
下面是示例代码:
import tweepy as tw
for status in tw.Cursor(api.user_timeline, screen_name='@somethingsomething', tweet_mode="extended").items():
#do something
知道如何做到这一点吗?
做非
我不是一个红宝石或rails程序员,但我的任务是反向工程一个RoR应用程序的API。我的HTTP请求没有通过验证检查,这一行应该提供特定的数据:
value = @_request.env['HTTP_X_MY_TOKEN'];
从我所拥有的很少的经验和我所做的搜索来看,它似乎是在寻找一个header MY_TOKEN,但我不确定是否是这样。
我当前的HTTP请求如下所示:
POST /myapp HTTP/1.1
Host: website.com:80
Content-Type: application/json
Content-Length: 12
my post d
我使用angular2-http(alpha.44)模块从REST Api中检索数据。我不知道如何访问响应的头映射中的信息,我需要一个特定的字段。示例:
var req = new Request({
url: `localhost/api/products`,
method: RequestMethods.Get
});
this.http.request(req).subscribe(
res => {
// Can't access the headers of the response here.... res.headers is empty