Importante

unireLa traduzione è uno sforzo comunitario you can join. Questa pagina è attualmente tradotta al 70.80%.

24.1.4. Strumenti file

24.1.4.1. Download file via HTTP(S)

Downloads a URL to the file system with an HTTP(S) GET or POST request.

Parametri

Parametri di Base

Etichetta

Nome

Tipo

Descrizione

URL

URL

[stringa]

L’URL del file da scaricare.

Destinazione file

OUTPUT

[stringa]

Predefinito: [Salva in file temporaneo]

Indicazione della destinazione del file. Una di:

  • Salva su File Temporaneo

  • Salva su File…

Parametri Avanzati

Etichetta

Nome

Tipo

Descrizione

Method

METHOD

[enumeration]

Predefinito: 0

Il metodo HTTP da utilizzare per la richiesta. Le opzioni sono:

  • 0 — GET

  • 1 — POST

Data

Opzionale

DATA

[stringa]

I dati da aggiungere nel codice se la richiesta è di tipo POST.

In uscita:

Etichetta

Nome

Tipo

Descrizione

Destinazione file

OUTPUT

[stringa]

La posizione del file scaricato

Codice Python

ID algoritmo: qgis:filedownloader

import processing
processing.run("algorithm_id", {parameter_dictionary})

L” id dell’algoritmo viene visualizzato quando si passa il mouse sull’algoritmo nella finestra degli strumenti di elaborazione. Il dizionario dei parametri fornisce i Nomi e i valori dei parametri. Vedi Usare gli algoritmi di Processing dalla console dei comandi per dettagli su come eseguire algoritmi di elaborazione dalla console 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.

Parametri

Etichetta

Nome

Tipo

Descrizione

URL or file path

URL

[stringa]

The URL or path of the file to open.

Method

METHOD

[enumeration]

Predefinito: 0

Il metodo HTTP da utilizzare per la richiesta. Le opzioni sono:

  • 0 — GET

  • 1 — POST

POST Data

Opzionale

DATA

[stringa]

I dati da aggiungere nel codice se la richiesta è di tipo POST.

Authentication

Opzionale

AUTH_CONFIG

[authconfig]

Default: No authentication

An authentication configuration to pass

Consider HTTP errors as failures

FAIL_ON_ERROR

[boolean]

Default: False

If set, the algorithm will fail on encountering an HTTP error.

Destinazione file

Opzionale

OUTPUT

[stringa]

Default: [Skip Output]

The result can be written to a file instead of being returned as a string. Specification of the file destination. One of:

  • Tralascia risultato

  • Salva su File Temporaneo

  • Salva su File…

In uscita:

Etichetta

Nome

Tipo

Descrizione

Destinazione file

OUTPUT

[file]

The downloaded file with the returned result

HTTP Status

STATUS_CODE

[stringa]

The HTTP Status

Network error code

ERROR_CODE

[stringa]

The error code when it fails (like as well on 404 HTTP Status etc.)

Network error message

ERROR_MESSAGE

[stringa]

A string containing the error message in case of failure

Result data

RESULT_DATA

[stringa]

A string containing the result data in case of success

Codice Python

Algorithm ID: native:httprequest

import processing
processing.run("algorithm_id", {parameter_dictionary})

L” id dell’algoritmo viene visualizzato quando si passa il mouse sull’algoritmo nella finestra degli strumenti di elaborazione. Il dizionario dei parametri fornisce i Nomi e i valori dei parametri. Vedi Usare gli algoritmi di Processing dalla console dei comandi per dettagli su come eseguire algoritmi di elaborazione dalla console 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.

Parametri

Etichetta

Nome

Tipo

Descrizione

URL or file path

URL

[stringa]

The URL or path of the file to open.

In uscita:

The algorithm has no output.

Codice Python

Algorithm ID: native:openurl

import processing
processing.run("algorithm_id", {parameter_dictionary})

L” id dell’algoritmo viene visualizzato quando si passa il mouse sull’algoritmo nella finestra degli strumenti di elaborazione. Il dizionario dei parametri fornisce i Nomi e i valori dei parametri. Vedi Usare gli algoritmi di Processing dalla console dei comandi per dettagli su come eseguire algoritmi di elaborazione dalla console Python.