- Python Automation Cookbook
- Jaime Buelta
- 224字
- 2021-08-13 15:51:14
Accessing web APIs
Rich interfaces can be created through the web, allowing powerful interactions through HTTP. The most common interface is through RESTful APIs using JSON. These text-based interfaces are easy to understand and to program, and use common technologies that are language agnostic, meaning they can be accessed in any programming language that has an HTTP client module, including, of course, Python.
The strict definition of RESTful requires some characteristics, but a more informal definition could be accessing resources through URLs. This means a URL represents a particular resource, such as an article in a newspaper or a property on a real estate site. Resources can then be manipulated through HTTP methods (GET to view, POST to create, PUT/PATCH to edit, and DELETE to delete) to manipulate them.
Using requests is very easy with them, as it includes native JSON support.