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

  • Python Social Media Analytics
  • Siddhartha Chatterjee Michal Krystyanczuk
  • 145字
  • 2021-07-15 17:24:57

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.

主站蜘蛛池模板: 安溪县| 洛浦县| 龙南县| 张家界市| 娄烦县| 监利县| 苍梧县| 铜山县| 进贤县| 浪卡子县| 宁河县| 石狮市| 宜丰县| 日土县| 崇信县| 宜君县| 吉林省| 滕州市| 渑池县| 鱼台县| 佛山市| 当阳市| 汝南县| 金门县| 长泰县| 金山区| 哈密市| 昌邑市| 平遥县| 堆龙德庆县| 镇雄县| 枣庄市| 河北区| 兴山县| 江华| 隆回县| 武强县| 临泽县| 包头市| 仲巴县| 顺平县|