10000 Updated the README.md · factorlibre/wc-api-python@7322875 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7322875

Browse files
Updated the README.md
1 parent b3f8de7 commit 7322875

File tree

1 file changed

+76
-10
lines changed

1 file changed

+76
-10
lines changed

README.md

Lines changed: 76 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,83 @@
1+
# WooCommerce API - Python Client
12

2-
# woocommerce-api
3+
A Python wrapper for the WooCommerce REST API. Easily interact with the WooCommerce REST API using this library.
34

4-
A Python wrapper for the WooCommerce REST API
5+
[![build status](https://secure.travis-ci.org/woothemes/wc-api-python.svg)](http://travis-ci.org/woothemes/wc-api-python)
56

6-
## README
7+
## Installation
78

8-
This is the README file for woocommerce-api
9+
```
10+
pip install woocommerce
11+
```
912

10-
There are many like it, but this one is mine.
13+
## Getting started
1114

12-
## Todo
15+
Generate API credentials (Consumer Key & Consumer Secret) following this instructions <http://docs.woothemes.com/document/woocommerce-rest-api/>
16+
.
1317

14-
[ ] Update README file with something useful about the project
15-
[ ] Write code
16-
[ ] Ship code
17-
[ ] Profit!
18+
Check out the WooCommerce API endpoints and data that can be manipulated in <http://woothemes.github.io/woocommerce-rest-api-docs/>.
19+
20+
## Setup
21+
22+
```py
23+
from woocommerce import WooCommerce
24+
25+
var WooCommerce = new WooCommerceAPI({
26+
url: 'http://example.com',
27+
consumerKey: 'ck_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
28+
consumerSecret: 'cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
29+
});
30+
```
31+
32+
### Options
33+
34+
| Option | Type | Required | Description |
35+
| ---------------- | -------- | -------- | --------------------------------------------------------------------------------------------------- |
36+
| `url` | `string` | yes | Your Store URL, example: http://woo.dev/ |
37+
| `consumerKey` | `string` | yes | Your API consumer key |
38+
| `consumerSecret` | `string` | yes | Your API consumer secret |
39+
| `version` | `string` | no | API version, default is `v3` |
40+
| `verify_ssl` | `bool` | no | Verify SSL when connect, use this option as `false` when need to test with self-signed certificates |
41+
42+
## Methods
43+
44+
| Params | Type | Description |
45+
| ---------- | ------------ | ------------------------------------------------------------ |
46+
| `endpoint` | `string` | WooCommerce API endpoint, example: `customers` or `order/12` |
47+
| `data` | `dictionary` | Data that will be converted to JSON |
48+
49+
### GET
50+
51+
- `.get(endpoint)`
52+
53+
### POST
54+
55+
- `.post(endpoint, data)`
56+
57+
### PUT
58+
59+
- `.put(endpoint, data)`
60+
61+
### DELETE
62+
63+
- `.delete(endpoint)`
64+
65+
## Response
66+
67+
All methods will return [Requests](http://docs.python-requests.org/en/latest/) object.
68+
69+
Example of returned data:
70+
71+
```bash
72+
>>> woocommerce.get("products")
73+
>>> woocommerce.status_code
74+
200
75+
>>> woocommerce.headers['content-type']
76+
'application/json; charset=UTF-8'
77+
>>> woocommerce.encoding
78+
'UTF-8'
79+
>>> woocommerce.text
80+
u'{"products":[{"title":"Flying Ninja","id":70,...' // Json text
81+
>>> woocommerce.json()
82+
{u'products': [{u'sold_individually': False,... // Dictionary data
83+
```

0 commit comments

Comments
 (0)
0