Skip to content

Commit

Permalink
add auth module
Browse files Browse the repository at this point in the history
  • Loading branch information
bdpedigo committed Jan 19, 2024
1 parent af26900 commit cb23777
Show file tree
Hide file tree
Showing 12 changed files with 269 additions and 289 deletions.
121 changes: 0 additions & 121 deletions CONTRIBUTING.md

This file was deleted.

55 changes: 27 additions & 28 deletions caveclient/auth.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import json
import logging
import os
import urllib
import webbrowser

import requests

from .base import (
handle_response,
)
import urllib
from .endpoints import auth_endpoints_v1, default_global_server_address
import os
import webbrowser
import requests
import json
import logging
import time

logger = logging.getLogger(__name__)

Expand All @@ -23,7 +24,6 @@


def write_token(token, filepath, key, overwrite=True):

if os.path.exists(filepath):
with open(filepath, "r") as f:
secrets = json.load(f)
Expand All @@ -45,33 +45,32 @@ def write_token(token, filepath, key, overwrite=True):


class AuthClient(object):
"""Client to find and use auth tokens to access the dynamic annotation framework services.
Parameters
----------
token_file : str, optional
Path to a JSON key:value file holding your auth token.
By default, "~/.cloudvolume/secrets/cave-secret.json"
(will check deprecated token name "chunkedgraph-secret.json" as well)
token_key : str, optional
Key for the token in the token_file.
By default, "token"
token : str or None, optional
Direct entry of the token as a string. If provided, overrides the files.
If None, attempts to use the file paths.
server_address : str, optional,
URL to the auth server. By default, uses a default server address.
"""

def __init__(
self,
token_file=None,
token_key=None,
token=None,
server_address=default_global_server_address,
):
"""Client to find and use auth tokens to access the dynamic annotation framework services.
Parameters
----------
token_file : str, optional
Path to a JSON key:value file holding your auth token.
By default, "~/.cloudvolume/secrets/cave-secret.json"
(will check deprecated token name "chunkedgraph-secret.json" as well)
token_key : str, optional
Key for the token in the token_file.
By default, "token"
token : str or None, optional
Direct entry of the token as a string. If provided, overrides the files.
If None, attempts to use the file paths.
server_address : str, optional,
URL to the auth server. By default, uses a default server address.
"""
if token_file is None:
server = urllib.parse.urlparse(server_address).netloc
server_file = server + "-cave-secret.json"
Expand Down
58 changes: 0 additions & 58 deletions changelog.md

This file was deleted.

44 changes: 41 additions & 3 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
{%
include-markdown "../CHANGELOG.md"
%}
---
title: Changelog
---

## 5.1.0

- Added get_oldest_timestamp call to chunkedgraph

## 5.0.1

- Fixed bug with desired_resolution being set at the client level
was being ignored in >5.0.0

## 5.0.0

- Added support for the new CAVE Materialization 3.0 API
Includes support for the new materialization API, which allows for
server side conversion of the units of position, and ensures that
all positions are returned with the same units, even after joins.
- Added support for querying databases that were materialized without merging
tables together. This will allow for faster materializations.
- Removed support for LiveLive query from the Materialization 2.0 API client.
Note.. <5.0.0 clients interacting with MaterializationEngine >4.7.0 servers will
use live live query but will doubly convert the units of position if you ask
for a desired resolution, as the old client will also do a conversion server side.
- Fixed interaction with api version querying of servers from individual
clients to work with verify=False. (useful for testing)
- Stored infromation from client about mapping between dataframe and table names
and original column names.
- Added support for suffixes and select columns to be passed by dictionary rather than list
making the selection an application of suffixes more explicit when there are collisions
between column names in joined tables.

---

## Older Upgrade Notes

Change all select_column calls to pass dictionaries rather than lists.
Change all suffix calls to pass dictionaries rather than lists.
Advocate for your server administrator to upgrade to MaterializationEngine 4.7.0 or later,
so you can use the new MaterializationEngine 3.0 API and client.
18 changes: 7 additions & 11 deletions docs/client_api/annotation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@
title: client.annotation
---

Note: the functionality described here will be accurate if the datastack you are using
is using the most up-to-date version of the annotation engine. If something seems
wrong with the documentation here, try checking the version of the annotation
engine returned by your client:

```python
type(client.annotation)
```

Extended documentation for all versions of the annotation client can be found
[here](../extended_api/annotation.md).
!!! note
The functionality described here will be accurate if the datastack you are using is using the most up-to-date version of the annotation service. If something seems wrong with the documentation here, try checking the version of the annotation engine returned by your client:
```python
type(client.annotation)
```
Extended documentation for all versions of the annotation client can be found
[here](../extended_api/annotation.md).

::: caveclient.annotationengine.AnnotationClientV2
options:
Expand Down
10 changes: 10 additions & 0 deletions docs/client_api/auth.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: client.auth
---

::: caveclient.auth.AuthClient
options:
heading_level: 2
show_bases: false
filters: ["!__init__"]
merge_init_into_class: false
Loading

0 comments on commit cb23777

Please sign in to comment.