Skip to content

Commit 3301e11

Browse files
committed
Progress
1 parent bc8a339 commit 3301e11

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed

src/vws/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
"""
44

55
from .vws import VWS
6+
from .query import CloudRecoService
67

78
__all__ = [
9+
'CloudRecoService',
810
'VWS',
911
]
1012

src/vws/query.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import io
2+
3+
class CloudRecoService:
4+
"""
5+
An interface to Vuforia Web Services APIs.
6+
"""
7+
8+
def __init__(
9+
self,
10+
client_access_key: str,
11+
client_secret_key: str,
12+
base_vws_url: str = 'https://vws.vuforia.com',
13+
) -> None:
14+
"""
15+
Args:
16+
client_access_key: A VWS client access key.
17+
client_secret_key: A VWS client secret key.
18+
base_vws_url: The base URL for the VWS API.
19+
"""
20+
self._client_access_key = client_access_key.encode()
21+
self._client_secret_key = client_secret_key.encode()
22+
self._base_vws_url = base_vws_url
23+
24+
def query(
25+
self,
26+
image: io.BytesIO,
27+
) -> str:
28+
"""
29+
Add a target to a Vuforia Web Services database.
30+
31+
"""

tests/test_query.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""
2+
Tests for helper functions for managing a Vuforia database.
3+
"""
4+
5+
import io
6+
from typing import Optional
7+
8+
import pytest
9+
from mock_vws import MockVWS
10+
from mock_vws.database import VuforiaDatabase
11+
12+
from vws import CloudRecoService, VWS
13+
from vws.exceptions import TargetProcessingTimeout
14+
15+
16+
class TestQuery:
17+
"""
18+
Tests for adding a target.
19+
"""
20+
21+
def test_query(
22+
self,
23+
client: VWS,
24+
high_quality_image: io.BytesIO,
25+
) -> None:
26+
"""
27+
No exception is raised when adding one target.
28+
"""
29+
cloud_reco_client = CloudRecoService(
30+
client_access_key='foo',
31+
client_secret_key='bar',
32+
)
33+
cloud_reco_client.query(image=high_quality_image)
34+
35+
# TODO test custom base URL

0 commit comments

Comments
 (0)