Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a729cd4
[48] redesign to stateless free functions with session class
trel Feb 19, 2026
3d3a0bd
checksum flag is a bool
trel Feb 21, 2026
83a3cf4
[45] read just returns bytes as data
trel Feb 21, 2026
8e09b44
times are strings - check http api itself
trel Feb 21, 2026
473ec7c
[47] increase coverage
trel Feb 21, 2026
2e6204d
ruff format
trel Feb 21, 2026
7aa436e
validate bytes type, with test
trel Feb 21, 2026
0ed1ba1
47squash - increase coverage
trel Feb 21, 2026
f11fc33
coverage, found http api 473
trel Feb 21, 2026
f6bf071
move HTTPSession from common
trel Feb 22, 2026
748fb32
[27] rename package and module to irods_http
trel Feb 22, 2026
0e36d99
tests clean themselves
trel Feb 22, 2026
469292a
tests clean themselves
trel Feb 22, 2026
03cca3f
tests clean themselves
trel Feb 22, 2026
91de50d
update return type for authenticate()
trel Feb 22, 2026
53fc6c2
squash - triggers a requests.post() error
trel Feb 23, 2026
f0bd54d
write supports ticket
trel Feb 24, 2026
40a54e2
read, small write, large write with tickets
trel Feb 24, 2026
54dec67
squash with README update
trel Feb 24, 2026
084ef79
squash - updated todo
trel Feb 24, 2026
b5eaba8
squash - removed test/__init__.py
trel Feb 24, 2026
8c2c3a9
squash - use named parameters
trel Feb 24, 2026
a2be019
squash - just check the error code
trel Feb 24, 2026
450df61
squash - construct headers in the session
trel Feb 24, 2026
a1314d4
use list, careful to avoid shadowing
trel Feb 24, 2026
b2a8aa4
check HTTP and iRODS status codes consistently
trel Feb 24, 2026
53eae7a
shadow python builtins, use noqa A002
trel Feb 24, 2026
2aea7ce
Revert "squash - removed test/__init__.py"
trel Feb 24, 2026
449404f
remove unnecessary aliases
trel Feb 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 17 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,35 @@ Documentation for the endpoint operations can be found [here](https://github.com
This wrapper is available via pip:

```
pip install irods-http-client
pip install irods-http
```

## Usage
To use the wrapper, follow the steps listed below.

```py
from irods_http_client import IRODSHTTPClient
import irods_http

# Create an instance of the wrapper with the base url of the iRODS server to
# be accessed. <host>, <port>, and <version> are placeholders, and need
# to be replaced by appropriate values.
api = IRODSHTTPClient('http://<host>:<port>/irods-http-api/<version>')
# Placeholder values needed for irods_http.authenticate()
url_base = "http://<host>:<port>/irods-http-api/<version>"
username = "<username>"
password = "<password>"

# Most endpoint operations require a user to be authenticated in order to
# be executed. Authenticate with a username and password, and store the
# token received.
token = api.authenticate('<username>', '<password>')
# Create an IRODSHTTPSession to an iRODS HTTP API server
session = irods_http.authenticate(url_base, username, password)

# When calling authenticate for the first time on a new instance, the token
# will be automatically set. To change the token to use operations as a
# different user, use `setToken()`.
api.setToken(token)
# Use the session for all other operations
response = irods_http.collections.create(session, '/<zone_name>/home/<username>/new_collection')

# Once a token is set, the rest of the operations can be used.
response = api.collections.create('/<zone_name>/home/<username>/new_collection')

# After executing the operation, the iRODS response data can be accessed like this.
# Check the resopnse for errors
if response['status_code'] != 200:
# Handle HTTP error.

if response['data']['irods_response']['status_code'] < 0:
# Handle iRODS error.
```

The data returned by the wrapper will be in this format:
The response dict will have this format:
```py
{
'status_code': <integer>,
Expand All @@ -53,7 +46,8 @@ The data returned by the wrapper will be in this format:
```
where `status_code` is the HTTP status code from the response, and `data` is the result of the iRODS operation.

If there is data returned by the iRODS server, it will contain a dictionary called `irods_response`, which has an additional `status_code` indicating the result of the operation on the servers side, as well as any other expected data if the operation was successful.
`response['data']` will contain a dict named `irods_response`, which will contain the `status_code` returned by the iRODS Server as well as any other expected properties.

```py
{
'irods_response': {
Expand All @@ -63,4 +57,6 @@ If there is data returned by the iRODS server, it will contain a dictionary call
}
```

More information regarding iRODS response data is available [here](https://github.com/irods/irods_client_http_api/blob/main/API.md).
When calling `data_objects.read()`, the `response['data']` will contain the raw bytes instead of a dict.

More information regarding iRODS HTTP API response data is available [here](https://github.com/irods/irods_client_http_api/blob/main/API.md).
31 changes: 31 additions & 0 deletions irods_http/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""iRODS HTTP client library for Python."""

from . import (
collections,
data_objects,
queries,
resources,
rules,
tickets,
users_groups,
zones,
)
from .irods_http import (
IRODSHTTPSession,
authenticate,
get_server_info,
)

__all__ = [
"IRODSHTTPSession",
"authenticate",
"collections",
"data_objects",
"get_server_info",
"queries",
"resources",
"rules",
"tickets",
"users_groups",
"zones",
]
Loading