Skip to content

Commit e1de259

Browse files
Added changes for works fine in pypi
1 parent fe07a43 commit e1de259

File tree

6 files changed

+109
-87
lines changed

6 files changed

+109
-87
lines changed

Diff for: .editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ charset = utf-8
99
trim_trailing_whitespace = true
1010
insert_final_newline = true
1111

12-
[*.md]
12+
[*.rst]
1313
trim_trailing_whitespace = false

Diff for: .gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
__pycache__
44
build/
55
dist/
6-
woocommerce.egg-info/
6+
*.egg-info/
77
run.py
88
run3.py

Diff for: LICENSE renamed to LICENSE.txt

File renamed without changes.

Diff for: README.md

-83
This file was deleted.

Diff for: README.rst

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
WooCommerce API - Python Client
2+
===============================
3+
4+
A Python wrapper for the WooCommerce REST API. Easily interact with the WooCommerce REST API using this library.
5+
6+
.. image:: https://secure.travis-ci.org/woothemes/wc-api-python.svg
7+
:target: http://travis-ci.org/woothemes/wc-api-python
8+
9+
10+
Installation
11+
------------
12+
13+
.. code-block:: bash
14+
15+
pip install woocommerce
16+
17+
Getting started
18+
---------------
19+
20+
Generate API credentials (Consumer Key & Consumer Secret) following this instructions http://docs.woothemes.com/document/woocommerce-rest-api/.
21+
22+
Check out the WooCommerce API endpoints and data that can be manipulated in http://woothemes.github.io/woocommerce-rest-api-docs/.
23+
24+
Setup
25+
-----
26+
27+
.. code-block:: python
28+
29+
from woocommerce import WooCommerce
30+
31+
wcapi = woocommerce.api(
32+
url="http://example.com",
33+
consumer_key="ck_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
34+
consumer_secret="cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
35+
)
36+
37+
38+
Options
39+
~~~~~~~
40+
41+
+--------------------+------------+----------+-------------------------------------------------------------------------------------------------------+
42+
| Option | Type | Required | Description |
43+
+====================+============+==========+=======================================================================================================+
44+
| ``url`` | ``string`` | yes | Your Store URL, example: http://woo.dev/ |
45+
+--------------------+------------+----------+-------------------------------------------------------------------------------------------------------+
46+
| ``consumerKey`` | ``string`` | yes | Your API consumer key |
47+
+--------------------+------------+----------+-------------------------------------------------------------------------------------------------------+
48+
| ``consumerSecret`` | ``string`` | yes | Your API consumer secret |
49+
+--------------------+------------+----------+-------------------------------------------------------------------------------------------------------+
50+
| ``version`` | ``string`` | no | API version, default is ``v3`` |
51+
+--------------------+------------+----------+-------------------------------------------------------------------------------------------------------+
52+
| ``verify_ssl`` | ``bool`` | no | Verify SSL when connect, use this option as ``false`` when need to test with self-signed certificates |
53+
+--------------------+------------+----------+-------------------------------------------------------------------------------------------------------+
54+
55+
Methods
56+
-------
57+
58+
+--------------+----------------+------------------------------------------------------------------+
59+
| Params | Type | Description |
60+
+==============+================+==================================================================+
61+
| ``endpoint`` | ``string`` | WooCommerce API endpoint, example: ``customers`` or ``order/12`` |
62+
+--------------+----------------+------------------------------------------------------------------+
63+
| ``data`` | ``dictionary`` | Data that will be converted to JSON |
64+
+--------------+----------------+------------------------------------------------------------------+
65+
66+
GET
67+
~~~
68+
69+
- ``.get(endpoint)``
70+
71+
POST
72+
~~~~
73+
74+
- ``.post(endpoint, data)``
75+
76+
PUT
77+
~~~
78+
79+
- ``.put(endpoint, data)``
80+
81+
DELETE
82+
~~~~~~
83+
84+
- ``.delete(endpoint)``
85+
86+
Response
87+
--------
88+
89+
All methods will return `Requests <http://docs.python-requests.org/en/latest/>`_ object.
90+
91+
Example of returned data:
92+
93+
.. code-block:: bash
94+
95+
>>> woocommerce.get("products")
96+
>>> woocommerce.status_code
97+
200
98+
>>> woocommerce.headers['content-type']
99+
'application/json; charset=UTF-8'
100+
>>> woocommerce.encoding
101+
'UTF-8'
102+
>>> woocommerce.text
103+
u'{"products":[{"title":"Flying Ninja","id":70,...' // Json text
104+
>>> woocommerce.json()
105+
{u'products': [{u'sold_individually': False,... // Dictionary data

Diff for: setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
raise RuntimeError("Cannot find version information")
1717

1818
# Get long description
19-
README = open(os.path.join(os.path.dirname(__file__), "README.md")).read()
19+
README = open(os.path.join(os.path.dirname(__file__), "README.rst")).read()
2020

2121
# allow setup.py to be run from any path
2222
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
2323

2424
setup(
25-
name="woocommerce",
25+
name="WooCommerce",
2626
version=VERSION,
2727
description="A Python wrapper for the WooCommerce REST API",
2828
long_description=README,

0 commit comments

Comments
 (0)