Working with Data Sources

Posted 阿难的机器学习计划

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Working with Data Sources相关的知识,希望对你有一定的参考价值。

1. The API is the link to request data from the host.

2. A endpoint is a route to retrive different data from the API.

3. Status codes indicate information about what happened with a request. Here are some codes that are relevant to GET requests:

  • 200 -- everything went okay, and the result has been returned (if any)
  • 301 -- the server is redirecting you to a different endpoint. This can happen when a company switches domain names, or an endpoint name is changed.
  • 401 -- the server thinks you‘re not authenticated. This happens when you don‘t send the right credentials to access an API (we‘ll talk about this in a later mission).
  • 400 -- the server thinks you made a bad request. This can happen when you don‘t send along the right data, among other things.
  • 403 -- the resource you‘re trying to access is forbidden -- you don‘t have the right permissions to see it.
  • 404 -- the resource you tried to access wasn‘t found on the server

4. json.dumps can convert the list and dictionary to string:

  best_food_chains_string = json.dumps(best_food_chains)

 Json.loads can convert the string to lists or dictionaries.

  fast_food_franchise_2 = json.loads(fast_food_franchise_string)

5. I can get the content of a response as a Python object by using .json() method.

  data = response.json()

6. .header property shows the content that how data was generated and how to decode it.

 

以上是关于Working with Data Sources的主要内容,如果未能解决你的问题,请参考以下文章

Working with Data Sources 8

Working with Data Sources 9

Working with Data Sources 2

Working with Data Sources 4

Working with Data Sources 2

Working With Data Sources 10