Learn how to use Flask frame to make API.

The order of business is 1) Relation between Server and Client 2) Make Server: app.py, 3) Make Client: index.html, and 4) let them work together

Things to make first in a new project: app.py, static directory, templates directory and index.html file.

in the setting load: 1) flask, 2) pymongo, 3)requests, and 4) bs4.

Use Ajax (POST and GET)

Trouble point:

I had trouble making database: Not showing up in Robo3T. Found that I was looking at a different collection (dbsparta instead of dbhomework collections).

Also had extra brackets:((((

--

--

I learn basic Python coding and Web Crawling. This week’s HW is using requests, BeautifulSoup to select (rank, title, author) of song list in genie website.

I started this using a part of codes in hello.py (requests, BaeautifulSoup) and changed URL. I just need to print the (rank, title, and artist). For each dataset, it printed rank, rank-up…, and extra lines.

After googling, I try

text[0:2].strip()

Still contains several lines of space

rank = a_rank.strip()

title=a_title.text.strip()

artist=a_artist.text.strip()

This fixed the problem.

--

--

Import the current Exchange rate Using Ajax and display it.

Content of W2: JavaScript, JQuery, Ajax practice,

Something Cool: It is cool to being able to post the real-time data in this page using Ajax.

Troublesome: I couldn’t figure out how to remove the gap between “달러-원 환율:” & “1131.78”:(((

--

--

한소영

한소영

Physicist, Educator, Director of Maker Innovation, USM