gportal.sftp
¶
download(target, local_dir='.', username=None, password=None)
¶
Downloads files to a local directory via SFTP.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target |
Union[str, Product, Iterable[Union[str, Product]]]
|
Remote path, Product object, or a list of them. |
required |
local_dir |
str
|
Local directory to download to. |
'.'
|
username |
Optional[str]
|
G-Portal username. If not provided, the value of |
None
|
password |
Optional[str]
|
G-Portal password. If not provided, the value of |
None
|
Returns:
| Type | Description |
|---|---|
Union[str, list[str]]
|
A local path of the downloaded file when |
Union[str, list[str]]
|
A list of local paths of the downloaded files when |
Source code in gportal/sftp.py
SFTP
¶
Wrapper of the G-Portal SFTP interface.
Attributes:
| Name | Type | Description |
|---|---|---|
client |
SFTPClient
|
An instance of |
Source code in gportal/sftp.py
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 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |
connect(username=None, password=None)
classmethod
¶
Opens an SFTP session with G-Portal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
username |
Optional[str]
|
G-Portal username. If not provided, the value of |
None
|
password |
Optional[str]
|
G-Portal password. If not provided, the value of |
None
|
Returns:
| Type | Description |
|---|---|
SFTP
|
An instance of |
Source code in gportal/sftp.py
close()
¶
listdir(path='/', /, filter_pattern=None, fullpath=False)
¶
Returns a list containing the names of the entries in the given path.
Wraps paramiko.SFTPClient.listdir.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path |
str
|
Remote path to list. It must be absolute. |
'/'
|
filter_pattern |
Optional[str]
|
Regular expression to filter the entries. |
None
|
fullpath |
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
list[str]
|
A list containing the names of the entries. |
Source code in gportal/sftp.py
download(target, local_dir)
¶
Downloads files to a local directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target |
Union[str, Product, Iterable[Union[str, Product]]]
|
Remote path, Product object, or a list of them. |
required |
local_dir |
str
|
Local directory to download to. |
required |
Returns:
| Type | Description |
|---|---|
Union[str, list[str]]
|
A local path of the downloaded file when |
Union[str, list[str]]
|
A list of local paths of the downloaded files when |