d3v-null / wp-api-python

A Python wrapper for the WooCommerce API.
MIT License
141 stars 34 forks source link

Help getting started, examples seem out of date #15

Closed sla-te closed 1 year ago

sla-te commented 3 years ago

Tried the below snippet and it asks me to put a callback. (TypeError: __init__() missing 1 required positional argument: 'callback')

from wordpress import API

wpapi = API(
    url="http://example.com",
    consumer_key="XXXXXXXXXXXX",
    consumer_secret="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    api="wp-json",
    version="wp/v2",
    wp_user="XXXX",
    wp_pass="XXXX",
    oauth1a_3leg=True,
    creds_store="~/.wc-api-creds.json"
)
derwent-m-js commented 3 years ago

Hey @chwba , could you post a full stack trace with line numbers? I don't believe this is from the WordPress API constructor.

tete2soja commented 1 year ago

Hello,

You have to add the new argument to the API constructor:

wpapi = API(
    url="https://example.com",
    consumer_key="XXXXXXXXXXXX",
    consumer_secret="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    api="wp-json",
    version="wp/v2",
    wp_user="XXXX",
    wp_pass="XXXX",
    oauth1a_3leg=True,
    callback="https://example.com",
    creds_store="~/.wc-api-creds.json"
)

I forked it and fix the example and the encoding issue (#17): https://github.com/Synoptik-Labs/wp-api-python