Third-party Python Libraries
All third-party Python libraries can be found on PYPI / Python Package Index and installed using PIP:
Bash | |
---|---|
1 2 3 4 5 |
|
This article will introduce several commonly used third-party libraries in Python.
1. HTTP Requests (requests
library)
The requests
library is a library used to send HTTP requests, with the official website at requests.readthedocs.io.
1.1 Sending GET Requests and Getting the Response Body
Python | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
Output:
Text Output | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
1.2 Sending More Complex Requests
Python | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
Output:
Text Output | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
|
2. Time Handling (arrow
library)
The arrow
library is a library for handling time, with the official website at arrow.readthedocs.io.
Python | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
Output:
Text Output | |
---|---|
1 2 3 4 5 6 7 |
|
3. XML to JSON (xmltodict
library)
The xmltodict
library is a library used to convert XML data into JSON, with the Github address at github.com/martinblech/xmltodict.
Python | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
Output:
Text Output | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 |
|