Skip to content

1.1.0 release #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
SDK Release Note
-----------------
* SDK upgrade from current version 1.0.1 to new version 1.1.0
* Supports OAS 3.1 standards
* JSON schema validation of request and response objects
* SDK objects are python objects so can be pickled and unpickled
* Supports python version >= 3.7
33 changes: 28 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# UniCourt Python SDK
# UniCourt Python SDK
The UniCourt SDK provides simplified access to the UniCourt API for applications written in the Python programming language.


Expand All @@ -10,7 +10,7 @@ See the UniCourt data model here (requires UniCourt account): [UniCourt Data Mod

### Requirements

- Python >=3.6
- Python >=3.7

## Installation
You can use the source code if you want to modify the package and use it as per your need. If you just want to use the package, just run:
Expand All @@ -21,7 +21,6 @@ pip install --upgrade unicourt
Install from source :

```sh
export SDK_VERSION=<new sdk version>
python setup.py install
```

Expand Down Expand Up @@ -79,6 +78,30 @@ for attorney in attorney_obj.norm_attorney_search_result_array:

# Invalidate the generated access token
Authentication.invalidate_token()
```


```
## Python Error Exceptions
SDK will throw Python error exceptions in the below mentioned scenario's.
- When the request agruments or data passed to the SDK functions are incorrect.

Example :
```
Callback.get_callbacks() got an unexpected keyword argument 'vardate'
```
- When the sever sends any error response.

Example :
```
Reason: Internal Server Error
HTTP response headers: HTTPHeaderDict({'Date': 'Tue, 13 Aug 2024 09:31:41 GMT', 'Content-Type': 'application/json', 'Content-Length': '145', 'Connection': 'keep-alive', 'Apigw-Requestid': 'ccMvJhfYoAMEWzA='})
HTTP response body: {"object": "Exception", "code": "UN500", "message": "INTERNAL_SERVER_ERROR", "details": "Has encountered a situation which needs to be handled."}
```
- When the response has any new values which are not supported by the SDK. This can occur only when using the older version of SDK.

Example :
```
1 validation error for ServiceStatusDownDetails
reason
Value error, must be one of enum values ('issueAtTheCourtSource', 'notIntegrated', 'brokenIntegration') [type=value_error, input_value='underMaintenance', input_type=str]
For further information visit https://errors.pydantic.dev/2.8/v/value_error
```
71 changes: 71 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
[tool.poetry]
name = "unicourt"
version = "1.1.0"
description = "UniCourt Enterprise APIs"
authors = ["OpenAPI Generator Community <team@openapitools.org>"]
license = "NoLicense"
readme = "README.md"
repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID"
keywords = ["OpenAPI", "OpenAPI-Generator", "UniCourt Enterprise APIs"]
include = ["unicourt/py.typed"]

[tool.poetry.dependencies]
python = "^3.7"

urllib3 = ">= 1.25.3"
python-dateutil = ">=2.8.2"
pydantic = ">=2"
typing-extensions = ">=4.7.1"

[tool.poetry.dev-dependencies]
pytest = ">=7.2.1"
tox = ">=3.9.0"
flake8 = ">=4.0.0"
types-python-dateutil = ">=2.8.19.14"
mypy = "1.4.1"


[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.pylint.'MESSAGES CONTROL']
extension-pkg-whitelist = "pydantic"

[tool.mypy]
files = [
"unicourt",
#"test", # auto-generated tests
"tests", # hand-written tests
]
# TODO: enable "strict" once all these individual checks are passing
# strict = true

# List from: https://mypy.readthedocs.io/en/stable/existing_code.html#introduce-stricter-options
warn_unused_configs = true
warn_redundant_casts = true
warn_unused_ignores = true

## Getting these passing should be easy
strict_equality = true
strict_concatenate = true

## Strongly recommend enabling this one as soon as you can
check_untyped_defs = true

## These shouldn't be too much additional work, but may be tricky to
## get passing if you use a lot of untyped libraries
disallow_subclassing_any = true
disallow_untyped_decorators = true
disallow_any_generics = true

### These next few are various gradations of forcing use of type annotations
#disallow_untyped_calls = true
#disallow_incomplete_defs = true
#disallow_untyped_defs = true
#
### This one isn't too hard to get passing, but return on investment is lower
#no_implicit_reexport = true
#
### This one can be tricky to get passing if you use a lot of untyped libraries
#warn_return_any = true
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
python_dateutil >= 2.5.3
setuptools >= 21.0.0
urllib3 >= 1.25.3
urllib3 >= 1.25.3, < 2.1.0
pydantic >= 2
typing-extensions >= 4.7.1
38 changes: 29 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,38 @@
# coding: utf-8

import os
from setuptools import setup, find_packages
from setuptools import setup, find_packages # noqa: H301

here = os.path.abspath(os.path.dirname(__file__))
os.chdir(here)

NAME = "unicourt"
VERSION = os.getenv("SDK_VERSION")
def _read(filename):
with open(os.path.join(os.path.dirname(__file__), filename)) as f:
return f.read()

def _generate_description():
description = []
description.append("The UniCourt Python Package provides simplified access to the UniCourt API for applications written in the Python programming language. Documentation of UniCourt's APIs can be found at docs.unicourt.com. API keys can be obtained by filling out the form here https://unicourt.com/contact-us/?c=sales&enterprise=1 \n")
changelog_file = os.getenv("CHANGELOG_FILE")
if changelog_file:
description.append(_read("CHANGELOG.rst"))
return "\n".join(description)

# To install the library, run the following
#
# python setup.py install
#
# prerequisite: setuptools
# http://pypi.python.org/pypi/setuptools

REQUIRES = ["python_dateutil >= 2.5.3", "urllib3 >= 1.25.3"]
NAME = "unicourt"
VERSION = "1.1.0"
PYTHON_REQUIRES = ">=3.7"
REQUIRES = [
"urllib3 >= 1.25.3, < 2.1.0",
"python-dateutil",
"pydantic >= 2",
"typing-extensions >= 4.7.1",
]

setup(
name=NAME,
Expand All @@ -24,14 +44,14 @@
url="https://unicourt.com/",
project_urls={
"Source": "https://github.com/UniCourt/enterprise-api-py-sdk/tree/main",
"Documentation": "https://docs.unicourt.com/",
"Documentation": "https://docs.unicourt.com/knowledge-base/python-sdk",
},
keywords=["UniCourt", "UniCourt Python Package",
"UniCourt Enterprise APIs"],
python_requires=">=3.6",
python_requires=PYTHON_REQUIRES,
install_requires=REQUIRES,
packages=find_packages(exclude=["test", "tests"]),
include_package_data=True,
long_description="""The UniCourt Python Package provides simplified access to the UniCourt API for applications written in the Python programming language. Documentation of UniCourt's APIs can be found at docs.unicourt.com. API keys can be obtained by filling out the form here https://unicourt.com/contact-us/?c=sales&enterprise=1
"""
long_description=_generate_description(),
package_data={"unicourt": ["py.typed"]},
)
2 changes: 1 addition & 1 deletion test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


## Getting started
To run the SDK tests you need python >= 3.6 and Git installed.
To run the SDK tests you need python >= 3.7 and Git installed.

## Test Parameters
- Run all tests
Expand Down
6 changes: 5 additions & 1 deletion test/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ def __init__(self) -> None:

def run(self):
args = self.parser.parse_args()
# getting the list of test file and re-order authentication test file at end to run.

# Getting the list of test file.
module_list = [re.sub("\.py", "", module) for module in os.listdir() if module.startswith("test") and module.endswith("py")]

# Re-order authentication test file at end to run.
index = module_list.index('test_authentication_api')
module_list[index], module_list[-1] = module_list[-1], module_list[index]

for module_name in module_list:
module = __import__(module_name)
class_name = [class_name for class_name in dir(module) if class_name.startswith('Test')][0]
Expand Down
1 change: 0 additions & 1 deletion test/test_attorney_analytics_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class TestAttorneyAnalytics:

def test_get_norm_attorney_by_id():
return AttorneyAnalytics.get_norm_attorney_by_id(
norm_attorney_id="NATYs4P6kDBkhKL8CF")
Expand Down
1 change: 0 additions & 1 deletion test/test_authentication_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


class TestAuthentication:

def test_list_all_token_ids():
return Authentication.list_all_token_ids()

Expand Down
1 change: 0 additions & 1 deletion test/test_case_analytics_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def test_get_case_count_analytics_by_norm_law_firm():
)

def test_get_case_count_analytics_by_norm_party():

return CaseAnalytics.get_case_count_analytics_by_norm_party(
page_number=1,
q='caseTypeId:"CTYPATMYyaJekdgj2c" AND caseFiledDate:[2017-01-01T00:00:00+00:00TO2021-11-30T00:00:00+00:00]'
Expand Down
28 changes: 12 additions & 16 deletions test/test_case_docket_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,20 @@


class TestCaseDocket:
# def test_get_attorney_associated_parties():
# return CaseDocket.get_attorney_associated_parties(
# attorney_id='ATTYgu01be2e4de654'
# )

# def test_get_attorney_by_id():
# return CaseDocket.get_attorney_by_id(
# attorney_id='ATTYgu01be2e4de654')
def test_get_attorney_associated_parties():
return CaseDocket.get_attorney_associated_parties(
attorney_id='ATTYgu01be2e4de654'
)

# def test_get_case():
# return CaseDocket.get_case(
# case_id='CASEakfbd1817d7431',
# )
def test_get_attorney_by_id():
return CaseDocket.get_attorney_by_id(
attorney_id='ATTYgu01be2e4de654'
)

# def test_get_case_sealed_case():
# return CaseDocket.get_case(
# case_id='CASEakfbd1817d7431',
# )
def test_get_case():
return CaseDocket.get_case(
case_id='CASEakfbd1817d7431',
)

def test_get_case_attorneys():
return CaseDocket.get_case_attorneys(
Expand Down
45 changes: 17 additions & 28 deletions test/test_case_document_api.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
from unicourt.model.case_document_order_pacer_options import CaseDocumentOrderPacerOptions
from unicourt.model.case_document_order_request import CaseDocumentOrderRequest
from unicourt.sdk.CaseDocuments import CaseDocuments


class TestCaseDocuments:

def test_get_case_document_download_by_id_with_no_preview():
return CaseDocuments.get_case_document_download_by_id(
case_document_id='CDOCaqe42a86394f63',
is_preview_document=True
is_preview_document=False
)

def test_get_case_document_download_by_id_with_preview():
Expand All @@ -18,42 +16,19 @@ def test_get_case_document_download_by_id_with_preview():
is_preview_document=True
)

# case_document_order_request = CaseDocumentOrderRequest(
# case_document_id="CDOCcre989d654fa05",
# is_preview_only=True,
# pacer_options=CaseDocumentOrderPacerOptions(
# pacer_user_id="URKYwer3tyh5r56gq2",
# pacer_client_code="Test UniCourt API",
# ),
# )

def test_order_case_document():
case_document_order_request = CaseDocumentOrderRequest(
case_document_id="CDOCcre989d654fa05",
is_preview_only=True
)
return CaseDocuments.order_case_document(
case_document_order_request=case_document_order_request
)

def test_get_case_document_order_callback_by_id():
case_document_order_request = CaseDocumentOrderRequest(
case_document_id="CDOCcre989d654fa05",
is_preview_only=True
)
response = CaseDocuments.order_case_document(
response, _ = CaseDocuments.order_case_document(
case_document_order_request=case_document_order_request
)
cbk_id = response[0]['case_document_order_callback_id']
cbk_id = response.case_document_order_callback_id
return CaseDocuments.get_case_document_order_callback_by_id(
case_document_order_callback_id=cbk_id
)

def test_get_document_by_id():
return CaseDocuments.get_document_by_id(
case_document_id='CDOCaqe42a86394f63'
)

def test_get_case_document_order_callbacks():
return CaseDocuments.get_case_document_order_callbacks(
date='2022-03-08T10:17:56+00:00', status='FAILURE', page_number=1
Expand All @@ -63,3 +38,17 @@ def test_get_case_documents():
return CaseDocuments.get_case_documents(
case_id='CASEgua4c06e119ea8'
)

def test_get_document_by_id():
return CaseDocuments.get_document_by_id(
case_document_id='CDOCaqe42a86394f63'
)

def test_order_case_document():
case_document_order_request = CaseDocumentOrderRequest(
case_document_id="CDOCcre989d654fa05",
is_preview_only=True
)
return CaseDocuments.order_case_document(
case_document_order_request=case_document_order_request
)
Loading
Loading