個人項目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.pswp.cn/news/389872.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/389872.shtml
英文地址,請注明出處:http://en.pswp.cn/news/389872.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

5918. 統計字符串中的元音子字符串

5918. 統計字符串中的元音子字符串 子字符串 是字符串中的一個連續(非空)的字符序列。 元音子字符串 是 僅 由元音(‘a’、‘e’、‘i’、‘o’ 和 ‘u’)組成的一個子字符串,且必須包含 全部五種 元音。 給你一個字…

咕泡-模板方法 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…

clone-graph

1. clone-graph Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. 思路:dfs,其實就是遞歸。 1 /**2 * Definition for undirected graph.3 * struct UndirectedGraphNode {4 * int label;5 * …

5919. 所有子字符串中的元音

5919. 所有子字符串中的元音 給你一個字符串 word ,返回 word 的所有子字符串中 元音的總數 ,元音是指 ‘a’、‘e’、‘i’、‘o’ 和 ‘u’ 。 子字符串 是字符串中一個連續(非空)的字符序列。 注意:由于對 word …

Scrum沖刺-Ⅳ

第四次沖刺任務 團隊分工 成員:劉鵬芝,羅樟,王小莉,沈興艷,徐棒,彭康明,胡廣鍵 產品用戶:王小莉 需求規約:彭康明,羅樟 UML:劉鵬芝,沈…

Github入門詳情教程

前言 之前我寫了一篇文章《一篇文章了解Github和Git教程》還延伸了幾篇閱讀,對大部分小白很有用,那么我繼續普及下Github頁面及其概念。 定義 GitHub 是一個網站,一個面向開源及私有軟件項目的托管平臺,因為只支持Git作為唯一的版…

機器人影視對接_機器學習對接會

機器人影視對接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…

Android系統啟動系列----init進程

Android系統啟動系列 Android系統啟動系列----init進程Android系統啟動系列----Zygote進程引言 在開發app的過程中,是不是會有疑問: java程序的運行不是從main方法開始么,怎么app入口是Application的onCreate方法?那java的運行環境…

598. 范圍求和 II

598. 范圍求和 II 給定一個初始元素全部為 0&#xff0c;大小為 m*n 的矩陣 M 以及在 M 上的一系列更新操作。 操作用二維數組表示&#xff0c;其中的每個操作用一個含有兩個正整數 a 和 b 的數組表示&#xff0c;含義是將所有符合 0 < i < a 以及 0 < j < b 的元…

mysql 數據庫優化之執行計劃(explain)簡析

數據庫優化是一個比較寬泛的概念&#xff0c;涵蓋范圍較廣。大的層面涉及分布式主從、分庫、分表等&#xff1b;小的層面包括連接池使用、復雜查詢與簡單查詢的選擇及是否在應用中做數據整合等&#xff1b;具體到sql語句執行效率則需調整相應查詢字段&#xff0c;條件字段&…

自我接納_接納預測因子

自我接納現實世界中的數據科學 (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…

距離產生美

那天下午我跟簡坐在學校操作草地上聊天 夕陽的余暉照射著我們 陽光在青草的縫隙間拉長了倒影 溫暖的晚風輕拂著簡劉海前的幾根發絲 淡淡的發香迎面撲來&#xff0c;我望著遠山上的煙囪。 對簡說&#xff1a; 我覺得我們坐得太近了。感覺相距 50cm 比較好。 簡一臉驚訝說&#x…

299. 猜數字游戲

299. 猜數字游戲 你在和朋友一起玩 猜數字&#xff08;Bulls and Cows&#xff09;游戲&#xff0c;該游戲規則如下&#xff1a; 寫出一個秘密數字&#xff0c;并請朋友猜這個數字是多少。朋友每猜測一次&#xff0c;你就會給他一個包含下述信息的提示&#xff1a; 猜測數字…

mysql數據庫中case when 的用法

場景1&#xff1a;比如說我們在數據庫存了性別的字段&#xff0c;一般都是存0 和 1 代表男和女 然后我們會得到0和1之后在java中判斷 &#xff0c;很麻煩有么有&#xff1f;其實我們完全可以在sql中判斷好之后拿來現成的。就是在sql中做判斷就ok SELECT*,CASEWHEN ly app th…

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 …

CRT配色

http://a0bd2668.wiz03.com/share/s/2wLipE0wJ4Wl28H1oC2BIvEv02vmgz3S_QjT2YHyWG2t2nng轉載于:https://blog.51cto.com/13420391/2164540

5920. 分配給商店的最多商品的最小值

5920. 分配給商店的最多商品的最小值 給你一個整數 n &#xff0c;表示有 n 間零售商店。總共有 m 種產品&#xff0c;每種產品的數目用一個下標從 0 開始的整數數組 quantities 表示&#xff0c;其中 quantities[i] 表示第 i 種商品的數目。 你需要將 所有商品 分配到零售商…

A*

轉自http://www.mamicode.com/info-detail-1534200.html康托展開X a[1]*(n-1)!a[2]*(n-2)!...a[i]*(n-i)!...a[n-1]*1!a[n]*0!其中a[i]表示在num[i1..n]中比num[i]小的數的數量逆康托展開由于&#xff1a;a[i]≤n-i, a[i]*(n-i)!≤(n-i)*(n-i)!<(n-i1)!于是我們得到&#x…

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…