Skip to content

Commit b4ca666

Browse files
committed
Updated README.md
1 parent 4453d91 commit b4ca666

File tree

2 files changed

+54
-34
lines changed

2 files changed

+54
-34
lines changed

CONTRIBUTING.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Contributing to OPA-python-client
2+
3+
We welcome contributions to [OPA-python-client](https://github.com/Turall/OPA-python-client)
4+
5+
## Issues
6+
7+
Feel free to submit issues and enhancement requests.
8+
9+
[OPA-python-client Issues](https://github.com/Turall/OPA-python-client/issues)
10+
11+
## Contributing
12+
13+
Please refer to each project's style and contribution guidelines for submitting patches and additions. In general, we follow the "fork-and-pull" Git workflow.
14+
15+
1. **Fork** the repo on GitHub
16+
2. **Clone** the project to your own machine
17+
3. **Commit** changes to your own branch
18+
4. **Push** your work
19+
5. Submit a **Pull request** so that we can review your changes
20+
21+
22+
## Testing
23+
```sh
24+
$ docker run -it --rm -p 8181:8181 openpolicyagent/opa run --server --addr :8181
25+
$ pytest
26+
```
27+
28+
NOTE: Be sure to merge the latest from "upstream" before making a pull request!

README.md

Lines changed: 26 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,19 @@ See offical documentation page [Open Policy Agent](https://www.openpolicyagent.o
1313
### Installation ###
1414

1515
```sh
16-
$ pip install OPA-python-client
16+
$ pip install OPA-python-client
1717
```
1818

19+
Alternatively, if you prefer to use `poetry` for package dependencies:
20+
21+
```bash
22+
$ poetry shell
23+
$ poetry add OPA-python-client
24+
```
1925

2026

2127

22-
## Usage Examples ##
28+
## Usage Examples
2329

2430
```python
2531
>>> from opa_client.opa import OpaClient
@@ -52,7 +58,7 @@ True
5258
```
5359

5460

55-
### Connection to OPA service ###
61+
### Connection to OPA service
5662

5763
```python
5864
from opa_client.opa import OpaClient
@@ -66,10 +72,9 @@ del client
6672
```
6773

6874

69-
### Connection to OPA service with SSL ###
75+
### Connection to OPA service with SSL
7076

7177
```python
72-
7378
from opa_client.opa import OpaClient
7479

7580

@@ -87,9 +92,7 @@ del client
8792
```
8893

8994

90-
91-
92-
### Update policy from rego file ###
95+
### Update policy from rego file
9396

9497
```python
9598
from opa_client.opa import OpaClient
@@ -104,10 +107,9 @@ del client
104107
```
105108

106109

107-
### Update policy from URL ###
110+
### Update policy from URL
108111

109112
```python
110-
111113
from opa_client.opa import OpaClient
112114

113115
client = OpaClient()
@@ -121,12 +123,10 @@ del client
121123
```
122124

123125

124-
### Delete policy ###
126+
### Delete policy
125127

126128

127129
```python
128-
129-
130130
from opa_client.opa import OpaClient
131131

132132
client = OpaClient()
@@ -138,12 +138,10 @@ client.get_policies_list() # response is []
138138
del client
139139
```
140140

141-
### Get raw data from OPA service ###
141+
### Get raw data from OPA service
142142

143143

144144
```python
145-
146-
147145
from opa_client.opa import OpaClient
148146

149147
client = OpaClient()
@@ -164,12 +162,11 @@ print(client.get_opa_raw_data("userinfo",query_params={"metrics": True}))
164162
del client
165163
```
166164

167-
### Save policy to file from OPA service ###
168-
169165

170-
```python
166+
### Save policy to file from OPA service
171167

172168

169+
```python
173170
from opa_client.opa import OpaClient
174171

175172
client = OpaClient()
@@ -179,12 +176,11 @@ client.opa_policy_to_file(policy_name="fromurl",path="/your/path",filename="exam
179176
del client
180177
```
181178

182-
### Delete data from OPA service ###
183-
184179

185-
```python
180+
### Delete data from OPA service
186181

187182

183+
```python
188184
from opa_client.opa import OpaClient
189185

190186
client = OpaClient()
@@ -195,12 +191,10 @@ del client
195191
```
196192

197193

198-
### Information about policy path and rules ###
194+
### Information about policy path and rules
199195

200196

201197
```python
202-
203-
204198
from opa_client.opa import OpaClient
205199

206200
client = OpaClient()
@@ -213,12 +207,10 @@ del client
213207
```
214208

215209

216-
### Check permissions ###
210+
### Check permissions
217211

218212

219213
```python
220-
221-
222214
from opa_client.opa import OpaClient
223215

224216
client = OpaClient()
@@ -255,7 +247,6 @@ hello {
255247

256248
check_data = {"message": "world"}
257249
client.check_policy_rule(input_data=check_data, package_path="play", rule_name="hello") # response {'result': True}
258-
259250
```
260251

261252
### Execute an Ad-hoc Query
@@ -291,7 +282,6 @@ print(client.ad_hoc_query(query_params={"q": "data.userinfo.user_roles[name]"}))
291282
#you can send body request
292283
print(client.ad_hoc_query(body={"query": "data.userinfo.user_roles[name] "}))
293284
# response is {'result': [{'name': 'eve'}, {'name': 'alice'}, {'name': 'bob'}]}
294-
295285
```
296286

297287
### Check OPA healthy. If you want check bundels or plugins, add query params for this.
@@ -306,12 +296,14 @@ print(client.check_health({"bundle": True})) # response is True or False
306296
# If your diagnostic url different than default url, you can provide it.
307297
print(client.check_health(diagnostic_url="http://localhost:8282/health")) # response is True or False
308298
print(client.check_health(query={"bundle": True}, diagnostic_url="http://localhost:8282/health")) # response is True or False
309-
310299
```
311300

312301

313-
# Contributing #
302+
# Contributing
303+
304+
Fell free to open issue and send pull request.
314305

315-
#### Free to open issue and send PR ####
306+
Thanks To [Contributors](https://github.com/Turall/OPA-python-client/graphs/contributors).
307+
Contributions of any kind are welcome!
316308

317-
### OPA-python-client supports Python >= 3.5
309+
Before you start please read [CONTRIBUTING](https://github.com/Turall/OPA-python-client/blob/master/CONTRIBUTING.md)

0 commit comments

Comments
 (0)