Extract data from an API Python

preview_player
Показать описание
Published on January 17, 2019:

In this video, we will learn to get data from an API.
It is a fairly simple process:
1. start by importing the code
2. send a get request, get a response object
3. Get the status code..returns an integer on success
4. get the data
5. get data in a more readable json format


In the previous video, we learnt:
1. Connect to SQL Server database on aws
2. Create a table in SQL Server database
3. Insert data to the created table

Previous Video:

Additional Reading material:

Code
#Step 1 start by importing the code
import requests
#step 2 send a get request, get a response object

#step 3: Get the status code..returns an integer on success

#step 4:get the data


#step 5: get data in a more readable json format


Additional information

#register for api @

#requests documentation


#understanding API'send


SUBSCRIBE to learn more about Power BI,Power Query, Power Pivot, Excel,SQL Server and Python!!

Our Playists:

ABOUT DAGDOO:
Website:

Questions? Comments and SUGESTIONS? You will find me here:

Twitter: @dagdooe

Category: Science & Technology
License: Standard YouTube License
Рекомендации по теме
Комментарии
Автор

oh my word thank you. been searching all over the internet and all i needed was object.json(). I couldn't' figure out for the life of me how to convert that raw text into proper json.

robbiechristian
Автор

Thank you for making such a mountainous task simple to understand.

aalozano
Автор

How can we save the result in a json file and that too in GCS bucket

rajatjain
Автор

Can you tell us how can we extract a particular field from that data?

travel_around
Автор

Hi, i got that we can read API as json
Then
How can we convert the same json to CSV
For doing partitions on that CSV ... Pls explain

Village_Crystal_Stone
Автор

Printing results is all simple but can you show how do you actually write the results into a file?

AaronCsc
Автор

Thanks for making this video sir! Teachers who make this coding related educational video are a gem to to the community!

rudeviper
Автор

@Learn 2 Excel Please do the needful help. I am beginner of python. please do the help me. how I can convert this text file into csv file and save it to the drive.

dehatibaniya
Автор

every API tutorial: "Imagine waiter in restaurant"

Trilliput
Автор

Thanks mate. Appreciate the simplistic explanation.

pravinvaz
Автор

Hey, very nice video, short and informative

lalitbajaj
Автор

Thanks for simply explaining and demonstrating it .

kalyan
Автор

I get 403 from a specific API. I already tried with headers, but no success.

robsonjunior
Автор

hi, how can i extract data on a website? please help me with a code that can only extract reviews and ratings on a review website without including all the other unnecessary information. and if there isnt a way, how can i clean it in order to only produce reviews?

preciousmarutha
Автор

If the output shows:
"id": "123"
"firstName": "Nancy"
"lastName": "Petty"
"city": "New York"
"building": "34"
"area": "East"
etc

How would I only have it return the values defined in "id" and "city"
So the output shows:
"id": "123"
"city": "New York"

And not pages of text, thats where im stuck rn:

slinfx
Автор

you have done a wonderfull tutorial about calling API.... thank you

mathewemmanuel
Автор

Thanks for the video! I am getting this error: "Max retries exceeded with URL". Could you please help me in solving this problem?

kaivalyapatkar
Автор

and if I have a key to access the API, how does it assign it?

hugoleon
Автор

You got a sub pal! A good and a short one!

theslayer
Автор

Thanks for your video, can I download the details in excel /csv /txt format ?
And, here API may contain high volume and looking for download on iterations instead load once. Please make video how to achieve the same.

krish