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

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.

主站蜘蛛池模板: 洪湖市| 专栏| 扶绥县| 柘荣县| 焦作市| 临汾市| 武清区| 阳江市| 盱眙县| 交城县| 蒙阴县| 佛教| 丹江口市| 彰化县| 陆丰市| 青铜峡市| 姜堰市| 方城县| 佛山市| 常熟市| 嘉峪关市| 丹东市| 江门市| 固镇县| 廉江市| 鹤壁市| 高唐县| 莱芜市| 确山县| 南昌县| 曲周县| 涞水县| 革吉县| 新兴县| 扶风县| 开封县| 六安市| 祁连县| 上饶县| 瑞安市| 六枝特区|