官术网_书友最值得收藏!

Selecting the endpoint

An endpoint indicates where a particular resource can be accessed. It is represented by an URL that contains the name of the action. Even though there are multiple endpoints for each API, we will focus on those used in the next chapters of the book. All other endpoints/actions you can find in the official API documentation.

The Twitter REST API allows clients to retrieve a sample of tweets based on search criteria. The search request is made up of a Boolean query with some additional optional parameters (to, from, list, url, and filter). We will store the endpoint URL for this resource in a url variable:

url_rest = "https://api.twitter.com/1.1/search/tweets.json" 

Similarly, we will use an endpoint URL for the Streaming API that returns a random sample stream of statuses:

url_streaming = "https://stream.twitter.com/1.1/statuses/sample.json" 

We will use both variables to retrieve and parse the data.

主站蜘蛛池模板: 农安县| 县级市| 原平市| 双鸭山市| 公主岭市| 安溪县| 天气| 宾川县| 南江县| 汨罗市| 南平市| 大厂| 惠州市| 郯城县| 临西县| 田东县| 吴桥县| 泸溪县| 清水河县| 克拉玛依市| 枣强县| 新干县| 津南区| 集贤县| 全州县| 阿合奇县| 上饶县| 准格尔旗| 珲春市| 新宁县| 理塘县| 和静县| 石泉县| 西宁市| 衡水市| 娱乐| 新疆| 永登县| 洛川县| 理塘县| 莱州市|