Важно
Translation is a community effort you can join. This page is currently translated at 36.50%.
24.1.4. File tools
24.1.4.1. Download file via HTTP(S)
Downloads a URL to the file system with an HTTP(S) GET or POST request.
Параметры
Basic parameters
Ярлык |
Имя |
Тип |
Описание |
---|---|---|---|
URL |
|
[string] |
The URL of the file to download. |
File destination |
|
[string] По умолчанию: |
Specification of the file destination. One of:
|
Advanced parameters
Ярлык |
Имя |
Тип |
Описание |
---|---|---|---|
Method |
|
[enumeration] Default: 0 |
The HTTP method to use for the request. Options are:
|
Data Optional |
|
[string] |
The data to add in the body if the request is a POST. |
Результаты
Ярлык |
Имя |
Тип |
Описание |
---|---|---|---|
File destination |
|
[string] |
The location of the downloaded file |
Код на Python
Algorithm ID: qgis:filedownloader
import processing
processing.run("algorithm_id", {parameter_dictionary})
ID алгоритма отображается при наведении мыши на алгоритм в Инструментах анализа. Словарь parameter dictionary содержит ключи параметров и их значения. См. Изпользование алгоритмов геообработки в консоли для детального описания того, как запускать алгоритмы анализа из консоли Python.
24.1.4.2. HTTP(S) POST/GET request
Performs a HTTP(S) POST/GET request and returns the HTTP status code and the reply data. If an error occurs then the error code and the message will be returned. Optionally, the result can be written to a file on the disk. By default the algorithm will warn on errors. Optionally, the algorithm can be set to treat HTTP errors as failures.
Параметры
Ярлык |
Имя |
Тип |
Описание |
---|---|---|---|
URL or file path |
|
[string] |
The URL or path of the file to open. |
Method |
|
[enumeration] Default: 0 |
The HTTP method to use for the request. Options are:
|
POST Data Optional |
|
[string] |
The data to add in the body if the request is a POST. |
Authentication Optional |
|
[authconfig] Default: No authentication |
An authentication configuration to pass |
Consider HTTP errors as failures |
|
[boolean] Default: False |
If set, the algorithm will fail on encountering an HTTP error. |
File destination Optional |
|
[string] Default: |
The result can be written to a file instead of being returned as a string. Specification of the file destination. One of:
|
Результаты
Ярлык |
Имя |
Тип |
Описание |
---|---|---|---|
File destination |
|
[file] |
The downloaded file with the returned result |
HTTP Status |
|
[string] |
The HTTP Status |
Network error code |
|
[string] |
The error code when it fails (like as well on 404 HTTP Status etc.) |
Network error message |
|
[string] |
A string containing the error message in case of failure |
Result data |
|
[string] |
A string containing the result data in case of success |
Код на Python
Algorithm ID: native:httprequest
import processing
processing.run("algorithm_id", {parameter_dictionary})
ID алгоритма отображается при наведении мыши на алгоритм в Инструментах анализа. Словарь parameter dictionary содержит ключи параметров и их значения. См. Изпользование алгоритмов геообработки в консоли для детального описания того, как запускать алгоритмы анализа из консоли Python.
24.1.4.3. Open file or URL
Opens files in their default associated application, or URLs in the user’s default web browser.
Параметры
Ярлык |
Имя |
Тип |
Описание |
---|---|---|---|
URL or file path |
|
[string] |
The URL or path of the file to open. |
Результаты
The algorithm has no output.
Код на Python
Algorithm ID: native:openurl
import processing
processing.run("algorithm_id", {parameter_dictionary})
ID алгоритма отображается при наведении мыши на алгоритм в Инструментах анализа. Словарь parameter dictionary содержит ключи параметров и их значения. См. Изпользование алгоритмов геообработки в консоли для детального описания того, как запускать алгоритмы анализа из консоли Python.