You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,32 +1,32 @@
1
1
## Setting up the environment
2
2
3
-
### With Rye
3
+
### With `uv`
4
4
5
-
We use [Rye](https://rye.astral.sh/) to manage dependencies because it will automatically provision a Python environment with the expected Python version. To set it up, run:
5
+
We use [uv](https://docs.astral.sh/uv/) to manage dependencies because it will automatically provision a Python environment with the expected Python version. To set it up, run:
6
6
7
7
```sh
8
8
$ ./scripts/bootstrap
9
9
```
10
10
11
-
Or [install Rye manually](https://rye.astral.sh/guide/installation/) and run:
11
+
Or [install uv manually](https://docs.astral.sh/uv/getting-started/installation/) and run:
12
12
13
13
```sh
14
-
$ rye sync --all-features
14
+
$ uv sync --all-extras
15
15
```
16
16
17
-
You can then run scripts using `rye run python script.py` or by activating the virtual environment:
17
+
You can then run scripts using `uv run python script.py` or by manually activating the virtual environment:
18
18
19
19
```sh
20
-
#Activate the virtual environment - https://docs.python.org/3/library/venv.html#how-venvs-work
Alternatively if you don't want to install `Rye`, you can stick with the standard `pip` setup by ensuring you have the Python version specified in `.python-version`, create a virtual environment however you desire and then install dependencies using this command:
29
+
Alternatively if you don't want to install `uv`, you can stick with the standard `pip` setup by ensuring you have the Python version specified in `.python-version`, create a virtual environment however you desire and then install dependencies using this command:
30
30
31
31
```sh
32
32
$ pip install -r requirements-dev.lock
@@ -45,7 +45,7 @@ All files in the `examples/` directory are not modified by the generator and can
45
45
```py
46
46
# add an example to examples/<your-example>.py
47
47
48
-
#!/usr/bin/env -S rye run python
48
+
#!/usr/bin/env -S uv run python
49
49
…
50
50
```
51
51
@@ -72,7 +72,7 @@ Building this package will create two files in the `dist/` directory, a `.tar.gz
72
72
To create a distributable version of the library, all you have to do is run this command:
The Cas Parser Python library provides convenient access to the Cas Parser REST API from any Python 3.9+
7
7
application. The library includes type definitions for all request params and response fields,
8
8
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
9
9
10
10
It is generated with [Stainless](https://www.stainless.com/).
11
11
12
-
## MCP Server
13
-
14
-
Use the Cas Parser MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.
15
-
16
-
[](https://cursor.com/en-US/install-mcp?name=cas-parser-node-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsImNhcy1wYXJzZXItbm9kZS1tY3AiXSwiZW52Ijp7IkNBU19QQVJTRVJfQVBJX0tFWSI6Ik15IEFQSSBLZXkifX0)
17
-
[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22cas-parser-node-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22cas-parser-node-mcp%22%5D%2C%22env%22%3A%7B%22CAS_PARSER_API_KEY%22%3A%22My%20API%20Key%22%7D%7D)
18
-
19
-
> Note: You may need to set environment variables in your MCP client.
20
-
21
12
## Documentation
22
13
23
-
The REST API documentation can be found on [docs.casparser.in](https://docs.casparser.in/reference). The full API of this library can be found in [api.md](api.md).
14
+
The full API of this library can be found in [api.md](api.md).
24
15
25
16
## Installation
26
17
27
18
```sh
28
19
# install from PyPI
29
-
pip install cas-parser-python
20
+
pip install cas_parser
30
21
```
31
22
32
23
## Usage
@@ -39,13 +30,12 @@ from cas_parser import CasParser
39
30
40
31
client = CasParser(
41
32
api_key=os.environ.get("CAS_PARSER_API_KEY"), # This is the default and can be omitted
33
+
# or 'production' | 'environment_2'; defaults to "production".
34
+
environment="environment_1",
42
35
)
43
36
44
-
unified_response = client.cas_parser.smart_parse(
45
-
password="ABCDF",
46
-
pdf_url="https://your-cas-pdf-url-here.com",
47
-
)
48
-
print(unified_response.demat_accounts)
37
+
response = client.credits.check()
38
+
print(response.enabled_features)
49
39
```
50
40
51
41
While you can provide an `api_key` keyword argument,
@@ -64,15 +54,14 @@ from cas_parser import AsyncCasParser
64
54
65
55
client = AsyncCasParser(
66
56
api_key=os.environ.get("CAS_PARSER_API_KEY"), # This is the default and can be omitted
57
+
# or 'production' | 'environment_2'; defaults to "production".
cas_parser= response.parse() # get the object that `cas_parser.smart_parse()` would have returned
266
-
print(cas_parser.demat_accounts)
239
+
credit= response.parse() # get the object that `credits.check()` would have returned
240
+
print(credit.enabled_features)
267
241
```
268
242
269
243
These methods return an [`APIResponse`](https://github.com/CASParser/cas-parser-python/tree/main/src/cas_parser/_response.py) object.
@@ -277,10 +251,7 @@ The above interface eagerly reads the full response body when you make the reque
277
251
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
278
252
279
253
```python
280
-
with client.cas_parser.with_streaming_response.smart_parse(
281
-
password="ABCDF",
282
-
pdf_url="https://you-cas-pdf-url-here.com",
283
-
) as response:
254
+
with client.credits.with_streaming_response.check() as response:
0 commit comments