Edit page in Livemark
(2022-09-19 18:33)

Remote Scheme

You can read files remotely with Frictionless. This is a basic functionality of Frictionless.

Reading Data

You can read using Package/Resource, for example:

from pprint import pprint
from frictionless import Resource

path='https://raw.githubusercontent.com/frictionlessdata/frictionless-py/master/data/table.csv'
resource = Resource(path=path)
pprint(resource.read_rows())
[{'id': 1, 'name': 'english'}, {'id': 2, 'name': '中国人'}]

Writing Data

A similar approach can be used for writing:

from frictionless import Resource

resource = Resource(path='data/table.csv')
resource.write('https://example.com/data/table.csv') # will POST the file to the server

Configuration

There is a Control to configure remote data, for example:

from frictionless import Resource
from frictionless.plugins.remote import RemoteControl

control = RemoteControl(http_timeout=10)
path='https://raw.githubusercontent.com/frictionlessdata/frictionless-py/master/data/table.csv'
resource = Resource(path=path, control=control)
print(resource.to_view())
+----+-----------+
| id | name      |
+====+===========+
|  1 | 'english' |
+----+-----------+
|  2 | '中国人'     |
+----+-----------+

Reference

schemes.RemoteControl (class)

schemes.RemoteControl (class)

Remote control representation

Signature

(*, title: Optional[str] = None, description: Optional[str] = None, http_timeout: int = 10, http_preload: bool = False) -> None

Parameters

  • title (Optional[str])
  • description (Optional[str])
  • http_timeout (int)
  • http_preload (bool)

schemes.remoteControl.http_timeout (property)

NOTE: add docs

Signature

int

schemes.remoteControl.http_preload (property)

NOTE: add docs

Signature

bool

It's a beta version of Frictionless Framework (v5). Read Frictionless Framework (v4) docs for a version that is currently installed by default by pip.