个人项目api接口_5个免费有趣的API,可用于学习个人项目等

个人项目api接口

Public APIs are awesome!

公共API很棒!

There are over 50 pieces covering APIs on just the Towards Data Science publication, so I won’t go into too lengthy of an introduction. APIs basically let you interact with some tool or service (which could be provided by literally anybody).

仅在Towards Data Science出版物上有50余篇关于API的文章,因此我不会过多地介绍它。 API基本上使您可以与某些工具或服务进行交互(实际上任何人都可以提供)。

You can use APIs to do retrieve some kind of information from a data source and then use it in your own script or application. Public (open) APIs are great because they allow any third-party developer to build something that can connect to an existing service.

您可以使用API​​从数据源中检索某种信息,然后在您自己的脚本或应用程序中使用它。 公共(开放)API很棒,因为它们允许任何第三方开发人员构建可以连接到现有服务的东西。

There are popular APIs to do “serious stuff” like track time-series stock data or provide updates on air quality. We won’t be touching those in this piece, as I wanted to share some fun APIs you can experiment on while you’re learning to interact with an API or even create one.

有流行的API可以执行“严重的任务”,例如跟踪时间序列的库存数据或提供空气质量的更新 。 在本文中,我们将不涉及这些内容,因为我想分享一些有趣的API,您可以在学习与API交互甚至创建API时进行试验。

You could even build a simple personal project with one of these, to learn how to connect an application to an API from whichever language you’re currently learning.

您甚至可以使用其中之一来构建一个简单的个人项目,以学习如何使用您当前正在学习的任何语言将应用程序连接到API。

Let’s get to it!

让我们开始吧!

1. PlaceGOAT —山羊的免费随机照片 (1. PlaceGOAT — Free random pictures of goats)

Image for post
Holy crap it’s a goat generated by PlaceGoat
天哪,这是PlaceGoat产生的山羊

I thought I’d kick things off with an adorable baby goat.

我以为我会和一只可爱的小山羊拉开序幕。

This is a really simple GET API where you can generate pictures of goats. I wish I had more to say but that’s really it. Here are links to the main site and the Github repository.

这是一个非常简单的GET API,您可以在其中生成山羊的图片。 我希望我有更多话要说,但是确实如此。 这里是主站点和Github存储库的链接 。

Image for post
PlaceGOAT main sitePlaceGOAT主站点

You can specify the width and the height in pixels of the image you want to generate like this:

您可以像这样指定要生成的图像的宽度和高度(以像素为单位):

http://placegoat.com/width/height

If you’re just looking to test out the requests library in Python, this would be a great place to start. If you need an idea, try writing a script to get a daily goat image and send it to your significant other (or your mom) every morning to remind them of how much you care about them. It’ll be a better version of breakfast in bed.

如果您只是想在Python中测试requests库,那么这将是一个不错的起点。 如果您需要一个主意,请尝试编写脚本以获取每日的山羊图像,并将其每天早上发送给您的重要其他人(或您的母亲),以提醒他们您对它们的关心程度。 这将是床上早餐的更好版本。

2.PokéApi—主要游戏的Pokémon数据库 (2. PokéApi — Pokémon database for main games)

Image for post
PokéApi main pagePokéApi主页

Pokémon! Gotta *GET ’em all, Pokémon!

神奇宝贝! 一定要把它们全部拿来,神奇宝贝!

The RESTful PokéApi is free to use and allows you to GET information from a comprehensive database on everything from the Pokémon games, from the first Red and Blue releases until Sword and Shield.

RESTfulPokéApi是免费使用的,并允许您从全面的数据库中获取有关Pokémon游戏,从第一个Red和Blue版本到Sword和Shield的所有内容的信息。

The database is really extensive. You can get anything from a Pokémon’s abilities to evolution triggers to berry firmness. Check out the PokéApi main site and the documentation directly for more information. If you’re interested in a language-specific wrapper, check the Wrapper Libraries section. For example, you could install the Pokebase Python interface for use directly in your Python scripts, instead of having to call the API with the requests library.

该数据库确实非常广泛。 从神奇宝贝的能力到进化的触发力到浆果的坚韧性,您都能得到任何东西。 直接查看PokéApi主站点和文档以获取更多信息。 如果您对特定于语言的包装感兴趣,请查看包装器库部分 。 例如,您可以安装Pokebase Python接口以直接在Python脚本中使用,而不必使用requests库调用API。

Image for post
PokéApi docsPokéApi文档

I didn’t know berries could be categorized by firmness. I wanted to find out more, so I followed this link:

我不知道浆果可以按硬度分类。 我想了解更多信息,所以我点击了此链接:

https://pokeapi.co/api/v2/berry-firmness/
Image for post
berry firmness results浆果硬度结果

Normally, when you call an API endpoint, you should also supply an ID or name to retrieve the information for a specific data point. With the PokéApi, they say that if you call an endpoint without an ID or name, you’ll get a default list of up to 20 resources available for the API. In this case, there are 5 possible results for the “berry firmness” endpoint, so you see all of them returned in JSON format when you call the link above.

通常,在调用API端点时,还应提供ID或名称以检索特定数据点的信息。 他们说,使用PokéApi,如果您调用没有ID或名称的端点,则将获得默认的列表,其中包含多达20个可用于该API的资源。 在这种情况下,“浆果硬度”端点有5种可能的结果,因此,当您调用上面的链接时,您会看到所有结果均以JSON格式返回。

It’s a good time to note that when you’re using fully open APIs, you should be mindful of how often you’re calling a service’s endpoints. The PokéApi removed its rate limiting (API configuration of how many requests can be made per time interval), but it still reminds users to limit how frequent their requests are to keep the hosting costs low. In their fair use policy, they say that people should locally cache requested resources and that DDoS attacks will result in a permanent IP address ban. Be responsible!

现在是要注意的好时机,当您使用完全开放的API时,应注意调用服务端点的频率。 PokéApi取消了速率限制(API配置,每个时间间隔可以发出多少请求),但它仍提醒用户限制其请求的频率以保持较低的托管成本。 他们说,在合理使用政策中,人们应该在本地缓存请求的资源,而DDoS攻击将导致永久性的IP地址禁止。 要负责任!

3. Rick and Morty API-Rick and Morty的角色,位置等 (3. The Rick and Morty API — Characters, locations, and more from Rick and Morty)

Image for post
The Rick and Morty API main siteRick and Morty API主站点

Rick and Morty!

瑞克和莫蒂!

This API is RESTful and allows you to use GraphQL to query it. They also conveniently link you to the GraphQL docs if you’re new to the query language. You can use the API by making GET requests for metadata on characters, locations, and episodes from the show.

该API是RESTful的,允许您使用GraphQL对其进行查询。 如果您是查询语言的新手,它们还可以方便地将您链接到GraphQL文档 。 您可以通过对节目中角色,位置和剧集的元数据发出GET请求来使用API​​。

Image for post
The Rick and Morty API docsRick and Morty API文档

To get information about a character from the show, you should supply their ID to the character endpoint like this:

要从演出中获取有关角色的信息,您应该像这样向角色端点提供其ID:

https://rickandmortyapi.com/api/character/5
Image for post
Jerry Smith resultsJerry Smith结果

Here, supplying “5” gives us the character information on Jerry Smith. You also see at the end an associated image of the character, so if you’re looking to practice downloading files from an API, this might be a good place to start.

在这里,提供“ 5”会给我们有关杰里·史密斯的角色信息。 您还将在最后看到该字符的关联图像,因此,如果您希望练习从API下载文件,那么这可能是一个不错的起点。

Check out the main site and the documentation for more information. There are also a bunch of wrapper libraries by several authors for different languages, so check those out if you‘d rather use those. The Python implementation for it can be found here. Also, if you know some JavaScript and are interested in contributing to an open-source project, you can check out The Rick and Morty API Github.

查看主站点和文档以获取更多信息。 还有一些由不同语言的作者组成的包装器库 ,因此请检查是否需要使用它们。 可以在这里找到它的Python实现。 另外,如果您知道一些JavaScript并有兴趣为开源项目做贡献,则可以查看The Rick and Morty API Github 。

4. icanhazdadjoke-爸爸笑话数据库 (4. icanhazdadjoke — Dad Jokes Database)

Image for post
icanhazdadjokes main siteicanhazdadjokes主站点

Who doesn’t like dad jokes?

谁不喜欢爸爸的笑话?

I’m not sure if my API-related puns so far count, but I definitely love all sorts of “bad” jokes.

我不确定到目前为止与我的API相关的双关语是否有用,但是我绝对喜欢各种“坏”笑话。

You can use the icanhazdadjoke API to fetch a dad joke from the service. The API documentation gives examples of how you can interact with the API’s endpoints with curl.

您可以使用icanhazdadjoke API从服务中获取爸爸的笑话。 API文档提供了有关如何使用curl与API端点进行交互的示例。

Image for post
icanhazdadjokes API documentationicanhazdadjokes API文档

curl is a neat tool you can use from your terminal to transfer data to or from a server. In this case, you could test it out by using HTTP to GET a specific URL. For example, you could try the following in your terminal:

curl是一个很好的工具,您可以从终端使用它来与服务器之间传输数据。 在这种情况下,您可以使用HTTP来获取特定的URL进行测试。 例如,您可以在终端中尝试以下操作:

curl -H "Accept: text/plain" https://icanhazdadjoke.com/
Image for post
icanhazdadjoke curl output
icanhazdadjoke卷曲输出

The -H command-line argument allows you to include one parameter, which in this case is “Accept: text/plain”, of an extra header in the request. This modification allows you to specify the type of output from your request, which here will just be plaintext. You could also set it to JSON (Accept: text/html) or HTML (Accept: Application/json) if that’s what you need.

-H命令行参数允许您在请求中包含一个额外头的参数,在本例中为“ Accept:text / plain”。 通过此修改,您可以指定请求的输出类型,此处只是纯文本。 如果需要,还可以将其设置为JSON( Accept: text/html )或HTML( Accept: Application/json )。

There’s also an endpoint you can use to search for specific jokes that match a certain keyword.

您还可以使用一个端点来搜索与某个关键字匹配的特定笑话。

Image for post
icanhazdadjoke API documentationicanhazdadjoke API文档

It could be interesting to practice searching for a few keywords by calling this endpoint and storing the results in a database. Then you’d have a local copy of jokes based on the keywords you specified.

通过调用此端点并将结果存储在数据库中来练习搜索一些关键字可能会很有趣。 然后,您将根据指定的关键字获得本地笑话副本。

Check out the main site and the documentation for more information. There’s also a GraphQL query endpoint you can use to query the API if you want to load data that way.

查看主站点和文档以获取更多信息。 如果要以这种方式加载数据,还可以使用GraphQL查询端点来查询API。

5.邪恶的侮辱产生者-均值数据库 (5. Evil Insult Generator — A Mean Database)

Image for post
Evil Insult Generator main site邪恶侮辱生成器主站点

… this site is mean.

…这个网站是卑鄙的。

The premise is really simple: you call the API and get an insult.

前提很简单:调用API并侮辱他人。

Image for post
Evil Insult Generator API documentationEvil Insult Generator API文档

Just like the goat API, I don’t really have that much to say here.

就像山羊API一样,我在这里没有太多要说的。

You can specify the language and the format of how you want the insult to be returned. For fun, I wanted to see if another language would actually work, so I tried to get a Spanish insult:

您可以指定希望如何返回侮辱的语言和格式。 为了娱乐,我想看看另一种语言是否真的可以工作,所以我试图受到西班牙的侮辱:

https://evilinsult.com/generate_insult.php?lang=es&type=json
Image for post
Result of Evil Insult Generator API call邪恶侮辱生成器API调用的结果

“Mala leche” translates literally to English as “bad milk”. Colloquially, you use it to describe someone that acts in bad faith or someone who’s in a bad mood.

“ Mala leche”字面意思是“坏牛奶”。 口语化地,您可以用它来形容表现出恶意的人情绪低落的人。

You can also use this API as a really simple one to practice making requests with. Check out the main site and its (rather simple) documentation if you want to explore.

您还可以将此API用作练习请求的一种非常简单的方法。 如果要浏览,请查看主站点及其(相当简单的) 文档 。

And that’s all!

就这样!

I hope you try working with one of these as you start familiarizing yourself with APIs or if you’re just looking for something fun to work with. Be sure to call the APIs responsibly, as these are public and meant to be consumed by everyone without charge. Pinging them too frequently can lead to your IP address being banned, which if you love goat pictures (or whatever service yo’re using) will not be a good thing.

我希望您在开始熟悉API或只是在寻找有趣的东西时尝试使用其中之一。 确保以负责任的方式调用这些API,因为这些API是公开的,并且每个人都可以免费使用。 过于频繁地对它们进行ping操作可能会导致您的IP地址被禁止,如果您喜欢山羊图片(或您使用的任何服务),那将不是一件好事。

Besides just calling GET requests, I mentioned that storing results might make for an interesting addition to your project, so check out this piece if you want to see how you can write to SQLite:

除了仅调用GET请求外,我还提到存储结果可能会对您的项目产生有趣的影响,因此如果您想了解如何写入SQLite,请查看以下内容:

For a completely different way of collecting data online, check out this piece on an introduction to the XPath language and its usage with Python:

对于一种完全不同的在线收集数据的方式,请查看关于XPath语言及其在Python中的用法的介绍:

翻译自: https://towardsdatascience.com/5-free-and-fun-apis-to-use-for-learning-personal-projects-and-more-1cb37b0d3685

个人项目api接口

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/389872.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

咕泡-模板方法 template method 设计模式笔记

2019独角兽企业重金招聘Python工程师标准>>> 模板方法模式(Template Method) 定义一个操作中的算法的骨架,而将一些步骤延迟到子类中Template Method 使得子类可以不改变一个算法的结构即可重定义该算法的某些特定步骤Template Me…

如何评价强gis与弱gis_什么是gis的简化解释

如何评价强gis与弱gisTL;DR — A Geographic Information System is an information system that specializes in the storage, retrieval and display of location data.TL; DR — 地理信息系统 是专门从事位置数据的存储,检索和显示的信息系统。 The standard de…

Scrum冲刺-Ⅳ

第四次冲刺任务 团队分工 成员:刘鹏芝,罗樟,王小莉,沈兴艳,徐棒,彭康明,胡广键 产品用户:王小莉 需求规约:彭康明,罗樟 UML:刘鹏芝,沈…

机器人影视对接_机器学习对接会

机器人影视对接A simple question like ‘How do you find a compatible partner?’ is what pushed me to try to do this project in order to find a compatible partner for any person in a population, and the motive behind this blog post is to explain my approach…

mysql 数据库优化之执行计划(explain)简析

数据库优化是一个比较宽泛的概念,涵盖范围较广。大的层面涉及分布式主从、分库、分表等;小的层面包括连接池使用、复杂查询与简单查询的选择及是否在应用中做数据整合等;具体到sql语句执行效率则需调整相应查询字段,条件字段&…

自我接纳_接纳预测因子

自我接纳现实世界中的数据科学 (Data Science in the Real World) Students are often worried and unaware about their chances of admission to graduate school. This blog aims to help students in shortlisting universities with their profiles using ML model. The p…

python中knn_如何在python中从头开始构建knn

python中knnk最近邻居 (k-Nearest Neighbors) k-Nearest Neighbors (KNN) is a supervised machine learning algorithm that can be used for either regression or classification tasks. KNN is non-parametric, which means that the algorithm does not make assumptions …

unity第三人称射击游戏_在游戏上第3部分完美的信息游戏

unity第三人称射击游戏Previous article上一篇文章 The economics literature distinguishes the quality of a game’s information (perfect vs. imperfect) from the completeness of a game’s information (complete vs. incomplete). Perfect information means that ev…

JVM(2)--一文读懂垃圾回收

与其他语言相比,例如c/c,我们都知道,java虚拟机对于程序中产生的垃圾,虚拟机是会自动帮我们进行清除管理的,而像c/c这些语言平台则需要程序员自己手动对内存进行释放。 虽然这种自动帮我们回收垃圾的策略少了一定的灵活…

2058. 找出临界点之间的最小和最大距离

2058. 找出临界点之间的最小和最大距离 链表中的 临界点 定义为一个 局部极大值点 或 局部极小值点 。 如果当前节点的值 严格大于 前一个节点和后一个节点,那么这个节点就是一个 局部极大值点 。 如果当前节点的值 严格小于 前一个节点和后一个节点,…

tb计算机存储单位_如何节省数TB的云存储

tb计算机存储单位Whatever cloud provider a company may use, costs are always a factor that influences decision-making, and the way software is written. As a consequence, almost any approach that helps save costs is likely worth investigating.无论公司使用哪种…

Django Rest Framework(一)

一、什么是RESTful REST与技术无关,代表一种软件架构风格,REST是Representational State Transfer的简称,中文翻译为“表征状态转移”。 REST从资源的角度审视整个网络,它将分布在网络中某个节点的资源通过URL进行标识&#xff0c…

数据可视化机器学习工具在线_为什么您不能跳过学习数据可视化

数据可视化机器学习工具在线重点 (Top highlight)There’s no scarcity of posts online about ‘fancy’ data topics like data modelling and data engineering. But I’ve noticed their cousin, data visualization, barely gets the same amount of attention. Among dat…

python中nlp的库_用于nlp的python中的网站数据清理

python中nlp的库The most important step of any data-driven project is obtaining quality data. Without these preprocessing steps, the results of a project can easily be biased or completely misunderstood. Here, we will focus on cleaning data that is composed…

一张图看懂云栖大会·上海峰会重磅产品发布

2018云栖大会上海峰会上,阿里云重磅发布一批产品并宣布了新一轮的价格调整,再次用科技普惠广大开发者和用户,详情见长图。 了解更多产品请戳:https://yunqi.aliyun.com/2018/shanghai/product?spm5176.8142029.759399.2.a7236d3e…

怎么看另一个电脑端口是否通_谁一个人睡觉另一个看看夫妻的睡眠习惯

怎么看另一个电脑端口是否通In 2014, FiveThirtyEight took a survey of about 1057 respondents to get a look at the (literal) sleeping habits of the American public beyond media portrayal. Some interesting notices: first, that about 45% of all couples sleep to…

Java基础之Collection和Map

List:实现了collection接口,list可以重复,有顺序 实现方式:3种,分别为:ArrayList,LinkedList,Vector。 三者的比较: ArrayList底层是一个动态数组,数组是使用…

20155320《网络对抗》Exp4 恶意代码分析

20155320《网络对抗》Exp4 恶意代码分析 【系统运行监控】 使用schtasks指令监控系统运行 首先在C盘目录下建立一个netstatlog.bat文件(由于是系统盘,所以从别的盘建一个然后拷过去),用来将记录的联网结果格式化输出到netstatlog.…

tableau 自定义省份_在Tableau中使用自定义图像映射

tableau 自定义省份We have been reading about all the ways to make our vizzes in Tableau with more creativity and appeal. During my weekly practice for creating viz as part of makeovermonday2020 community, I came across geographical data which in way requir…

2055. 蜡烛之间的盘子

2055. 蜡烛之间的盘子 给你一个长桌子,桌子上盘子和蜡烛排成一列。给你一个下标从 0 开始的字符串 s ,它只包含字符 ‘’ 和 ‘|’ ,其中 ’ 表示一个 盘子 ,’|’ 表示一支 蜡烛 。 同时给你一个下标从 0 开始的二维整数数组 q…