Part 2: Currency Exchange Table Look Up
In order to calculate the transactions in the later sections, you need to access the currency exchange information. The currency exchange rate table can be found in URL: https://www.cs.purdue.edu/homes/jind/exchangerate.html. In order to access the information, you need to implement a basic web crawler. For this project, your crawler only need to collect currency exchange rate information.
The first thing your crawler should do is to specify the URL you would like to fetch. Then use an URL open function with this request object to return a response object for the URL requested. This response is a file-like object, which means you can call functions such as .read() on the response. Further, it is known that the dominant character encoding for the World Wide Web is UTF-8. Use this registered codec for decoding. To be more specific, you need to define:
#helps fetch currency information from the currency table
#url: specifies the url you are trying to fetch, type: string, example: “http://www.google.com”
#RETURN: currency information list, type: nested list
#Create request object and get web content by given url
#Read the currency exchange table and put the information in a nested list called, e.g. records
#Each element in records will contain the currency name and a list of the exchange rate between USD
#The sublist includes the rate stored in the first column, and the rate stored in the second column of the webpage table
#i.e., records = [[‘Argentine Peso’, [9.44195, 0.10591]], [‘Australian Dollar’, [1.41824, 0.7051]], …]
#In the end, fetch() should return records
Is this question part of your Assignment?
We can help
Our aim is to help you get A+ grades on your Coursework.
We handle assignments in a multiplicity of subject areas including Admission Essays, General Essays, Case Studies, Coursework, Dissertations, Editing, Research Papers, and Research proposalsHeader Button Label: Get Started NowGet Started Header Button Label: View writing samplesView writing samples