No Title

Expires in 3 months

23 December 2021

Views: 348

Operating with other APIs - constructing a discord.py bot - aspect 12

howdy men my name is Ethan it's. coverup good happens once I did. you the way to construct this little popup for. your server in these days we are talking approximately. working with api's so let's get into it. it is a new addition to the plan this. is quite a very lastminute entry but. a lot of people in my server do do it so. i thought i would quickly cover a very easy. AP i feel because it is fairly rattling. easy so we're gonna go into our fond. calm over there. and we're gonna create an you return on. down here and we gonna say come on call. equals truth and it is just gonna. display animal information so async deaf. animal animates and all fats self context. after which we are gonna have a gonna have. an animal which if it passes a string. that is important because we will get an. on a actuality of a specific animal so. we are gonna do is we're gonna circulate this.

For now and i am in fact going to expose. you what the web site so if we open a brand new. window firefox after which if i am getting the. associated from my plan real rapid it's. HTTP 3 a few random it's some . random attached APA dots this will take. you to this page now this you get like a. number of alternative API so we are gonna. be utilizing the facts and the pictures 1 to. construct a little certainty but there are. others down right here as well without a doubt those. are not the only apos you can do i am just. utilizing them since the URLs are certainly. easy to do and you don't want anything. like tokens or anything like that so we. are going to if I simply come over right here. real quick in fact cross to disregard the. links for now and we are gonna write some . code so um we have to use whatever. known as a Oh a a io HTTP for this which I. believe we have to import.

So I'm gonna do suppose it is i personally. don't know if it's thirdparty or now not I. may wish to pick and store correctly. due to the fact it is a AO HTTP ok i think I. think we get it once we established this. known as up I I'm quite sure so that. should be great if you don't have it and. simply soon move and get it from a HTTP. import Ric quest and go into it right here and. then we do that will set a URL he calls. an end whilst we actually do whatever to. cut the yarra so we're gonna get a dog. reality first we're simply gonna get a actuality. about puppy for the time you recognize i think. i am gonna leave the animal for now and. we are going to come back that up there to be a. puppy fact so a sink with request get URL. head I don't believe we need any headers. for this one so i am correctly gonna depart. that as reaction if you probably did desire head as. you may circulate it via as headers.

Headers headers there oh my god. equals an additional dictionary of headers but. that we don't want I'm correctly gonna. move to empty head is just as a reaction. if response reputation because equals Two hundred. which means ok so we can then get our. data which we are gonna say information equals a. weight response dot JSON this could I. assume mean i feel we will out accesses. immediately so as you'll find if i could move. right here at the end point of the API let you. just spews out some uncooked data. this is what they forgot I'm gonna make. this slightly bigger to see the oldest. intact fossilized remains of a pet. dogs dates returned 3,000 studying. Siberian Seventies so we have our our key. actuality and our price it truly is this the sole. component we even have is a reality so you. can simply come over here i am correctly. gonna make this somewhat larger as well. have our textual content equals information information after which.

I will shoot in order that we will allow you simply. do a weight CTX dots and information reality and. then that ought to work and then we can. have like an else the waste CTX dots and. we will actually have a like an F. reaction no we could make it slightly more. donor API returns a string after which. reaction dot repute and that should. go back just any repute it comes returned. with that allows you to launch that go into. discards bring out of here that ought to. simply paintings did it include a web a dick. 11 blunders in the world. I watched the incorrect bot. wait hang on is he utilizing the incorrect. channel whatever I do not know what is. taking place there I'm gonna quickly uh uh. no because I did I did clone the channel. so I'd just maybe you're not up to date. something i'd be an interesting one oh. ok i thought we'd converted it but. interestingly no longer there we pass okay details.

And then oh yeah so the concept a dog. saliva has healing powers has been. around a minimum of on account that the ancient Greeks. and Romans whose physicians believed it. to be in an antidote for poisoning you. can get a different actuality puppies have a 6th. sense that is that's a good actuality yeah. that's an exceedingly that is an incredibly easy. API call notwithstanding we are not achieved due to the fact. we are gonna spruce up we're gonna spruce. it up a bit of so first thing. we are gonna do is we're gonna set a. customizable animal after which we're gonna. determine that the animal is correct so if. animal in after which and may take a look. at the animals this issue actually is. able to use so Jesus okay it's a dog cat. panda fox hen and koala okay so don't. forgot it immediately dog cat and whoops. as Fox burning coal ok. Fox yet oops : and that should correctly.

Be a lowercase considering it. P cuz it's simply to make matters less difficult so. that people can choose regardless of the case. they need plus we actually positioned animal. that decrease that needs to be sufficient. string brilliant and that should be an. charm as well. cool so and then else awaits every it. sends no fax yeah available there we go. come on. and then we will do some might perform a little. mistakes dealing with here so animal info. mistakes i am sure I haven't done any error. handling for the echo if that if that. does error just upload a few error handling. to it I might be will sooner or later I. maybe desire to do some in fact do I. do the thingy here it's simply lacking. document on how I do okay no we don't need. to do any blunders dealing with there right here then. to a very good consultation that work they. seem cool facts so if you just do reality. now say missing truth cat which will get a.

Cat certainty. cats have scent glands alongside their tail. their forehead lips chin and underside. in their the front paws if you do like a fat. information shark no information are available for. that animal we just form of say you know. do a little fantastical stuff and it's. awesome but it's still it is still a. little bit uninteresting so we're gonna make an. nbit out of it due to the fact lets we make. n bits out of everything and rarely. in fact too significant yet don't worry. have you ever finished we haven't so ought to. actually try this Emily due to the fact n bears. title whoops identify equals animal dot. title reality and you can might be just. do it in an outline thinking about it. could not wait yeah. come over right here whoops it is description. equals concerning the fact color certain color. color equals equals i am going to put a dot. beyond that line on come on i'll clarify.

That see text writer colour I name it see. text I do not know boy and then that. must be four you may positioned author and a. footer on there if you wish yet i'm not. gonna bother with that for now. that quantity five cat it may make an. embed of it it's aalmost definitely crash. does not does not what is it what is it finished. what have I completed incorrect. oh there we go just took from i am going to do it. okay maybe it was just the API what a. bit bizarre yeah so one can now generate. every type of random facts and we will. output with embeds and now we're now. gonna get a picture for a little fact. regrettably that is a bit demanding. part of this API is that the verb is got. chook right here after which burb here which is. kill annoying so we are gonna get fax URL. after which I perhaps doesn't should be a. constant indisputable fact that URL after which photograph. URL equals F and then thiis just as you.

Can see if we click on this we are going to get an. picture of a dog completely random photo. of a puppy no idea where it is getting. those pictures from however it is getting an. image from a puppy from somewhere after which. we do. don't decrease doesn't devour cool she loved. me so I just make animal there we pass so. much less difficult the beauties of Python 3.8. characters wherein I imply it would not consume. cool hen else o to make extra experience if. you do this form round. so verb if animal equals equals chicken. else animal genuinely stressful little bit of the. API there but i am dwelling i think it is. embed set photo URL equals be image URL. Oh matchmaker discord bot that cool community it's. now not be able to get photograph of all of your L. is not explained without a doubt I haven't. modified the remainder of the variables round. where is it doing it earlier than here. fantastic in fact no I just proposal. we're going to doing an async request.

For that aas well we are doing a sync. with requests should we simply get the. photo instantly up just carry it a sink. in which the request receives I do not know if. you can do magic you may do requests. with a request I can't imagine to be a. limitation with that. headers equals that as reaction if. response dot fame equals 2 hundred photograph. equals a weight reaction suitable JSON. facts Nobita definite of course I do not know. what it is it is associated image not ever mind. else and then we make a moment request. if if is truly referred to as photo link simply. so it's kind of simply so it's a bit of. nicer variable generally no modified. unknowable that should i suppose we will see. actuality cat desire a cat truth please no. parroting object isn't such well the. ball Oh screw you silly cow activities. bastard whats up I hate that much approximately. image link equals data. you cannot simply subscribe Kuragin gadgets.

is quite there we go so you know have a cat info cat it takes a short time you are three hundred and sixty five days historical pop is is that this physically which changed into a fifteen or human goodddamn and simply to expose you element chicken it connects to the right issue my kid is enemy wow that is quite dazzling in fact and seen as you know my profile photo as a fox and let's get back to my men and women or not there we pass well this is also noticeably bigger animals Eagles Curly's goebbels bears mountain and mountain lions I really wanted to grasp that and so due to the fact I was lots a bit of a please wait but I believe we are going for walks out of time the episodes gone on for rather a while well so i am gonna leave that yet that is kind of a way to do work of api's you could do like a touch please wait mrs.

Here's my website: https://gogodev.info/get-matched-with-the-matchmaker-discord-bot-players/

Share