https://github.com/mcfunley/etsy-python
to make createListing API calls to the Etsy API recently?
Can you give me an example how it is supposed to be used?
I've done the process with authorising the application and getting the
token described here: http://www.etsy.com/developers/documentation/getting_started/oauth
and it seemed fine, with all required permissions, and saved the token
key and token secret into config.py
When I try something like in test_v2.py in to source directory of etsy-
python, like this:
import oauth2 as oauth
from etsy import Etsy, EtsyEnvSandbox, EtsyEnvProduction
from etsy.oauth import EtsyOAuthClient
import config
etsy_env = EtsyEnvProduction()
oauth_client =
EtsyOAuthClient(oauth_consumer_key=config.oauth_consumer_key,
oauth_consumer_secret=config.oauth_consumer_secret, etsy_env=etsy_env)
oauth_client.token = oauth.Token(key=config.oauth_token_key,
secret=config.oauth_token_secret)
etsy_api = Etsy(etsy_oauth_client=oauth_client, etsy_env=etsy_env)
r1 = etsy_api.createListing(description='test description',
title='test title', price=25, shipping_template_id=7271435,
quantity=1)
all I get is:
ValueError: Could not decode response from Etsy as JSON: 'This method
requires authentication.'
It seems that currently etsy-python does all requests with api_key, so
I
tried to hack it, and in _core.py around line 310 moved the line:
kwargs.update(dict(api_key=self.api_key))
to be included only with GET, but not with POST request.
But then when I try to run createListing() I get:
'API request missing api_key or valid OAuth parameters'
Any other ideas?
P.S. When I login on the website to the user I got the token for, on
http://www.etsy.com/your/apps I see the app on the list of authorised
apps, and the API key I use has
Production API 10 per sec. 10,000 per day 10 per sec. 10,000 per
day Full Access
on https://www.etsy.com/developers/your-apps
The consumer key and secret is the same for Sandbox and Production I
suppose, because there is only one given?
Of course the token key and token secret where generated with the
production API. I even tried regenerating it again, but with the same
results.
On Dec 11, 4:41 pm, Miernik <pub...@public.miernik.name> wrote:
> On Dec 11, 10:01 pm, SnakeO <jakech...@gmail.com> wrote:
>
> > Try removing the 'api_key' parameter that gets sent
>
> It seems that currently etsy-python does all requests with api_key, so
> I
> tried to hack it, and in _core.py around line 310 moved the line:
>
> kwargs.update(dict(api_key=self.api_key))
>
> to be included only with GET, but not with POST request.
>
> But then when I try to run createListing() I get:
>
> 'API request missing api_key or valid OAuth parameters'
>
> Any other ideas?
>
> P.S. When I login on the website to the user I got the token for, onhttp://www.etsy.com/your/appsI see the app on the list of authorised
> apps, and the API key I use has
>
> Production API 10 per sec. 10,000 per day 10 per sec. 10,000 per
> day Full Access
>
> onhttps://www.etsy.com/developers/your-apps
I'm running Debian.
Python 2.7
POST /v2/listings HTTP/1.1
Host: openapi.etsy.com
Content-Length: 528
content-type: multipart/form-data; boundary=----------
ThIs_Is_tHe_bouNdaRY_$
accept-encoding: gzip, deflate
authorization: OAuth realm="http://openapi.etsy.com",
oauth_body_hash="RvkuvCKWTfSNobGaypnRskgpPwo%3D",
oauth_nonce="53708996", oauth_timestamp="1323667604",
oauth_consumer_key="12xx85u7zyjuolg2lqq9ctqa",
oauth_signature_method="HMAC-SHA1", oauth_version="1.0",
oauth_token="82aa6eb0dea248fc97b303e7da7635",
oauth_signature="SPDSMmWg8Zvgw02lGTh7lZ2Xwqo%3D"
user-agent: Python-httplib2/0.7.2 (gzip)
------------ThIs_Is_tHe_bouNdaRY_$
Content-Disposition: form-data; name="description"
test description
------------ThIs_Is_tHe_bouNdaRY_$
Content-Disposition: form-data; name="price"
25
------------ThIs_Is_tHe_bouNdaRY_$
Content-Disposition: form-data; name="quantity"
1
------------ThIs_Is_tHe_bouNdaRY_$
Content-Disposition: form-data; name="shipping_template_id"
7271435
------------ThIs_Is_tHe_bouNdaRY_$
Content-Disposition: form-data; name="title"
test title
------------ThIs_Is_tHe_bouNdaRY_$--
HTTP/1.1 400 Bad Request
Date: Mon, 12 Dec 2011 05:26:44 GMT
Server: Apache
X-Error-Detail: API request missing api_key or valid OAuth parameters
X-Etsy-Request-Uuid: IdiJlE94acSxeFwvxaKBhlKvtkU8
Content-Length: 53
X-Cnection: close
Content-Type: text/plain;charset=UTF-8
to be POSTed instead of just in the header?
I tried constructing such POST manually, and got something like this.
Good that the error is now different.
Bad that it's still wrong. Why does it say "parameters_absent" about
parameters I provide?
miernik@przehyba:~$ telnet openapi.etsy.com 80
Trying 38.106.64.22...
Connected to openapi.etsy.com.
Escape character is '^]'.
POST /v2/listings HTTP/1.1
Host: openapi.etsy.com
Content-Length: 1410
content-type: multipart/form-data; boundary=----------
ThIs_Is_tHe_bouNdaRY_$
accept-encoding: gzip, deflate
authorization: OAuth realm="http://openapi.etsy.com",
oauth_body_hash="RvkuvCKWTfSNobGaypnRskgpPwo%3D",
oauth_nonce="53708996", oauth_timestamp="1323667604",
oauth_consumer_key="12xx85u7zyjuolg2lqq9ctqa",
oauth_signature_method="HMAC-SHA1", oauth_version="1.0", oau
user-agent: Python-httplib2/0.7.2 (gzip)
------------ThIs_Is_tHe_bouNdaRY_$
Content-Disposition: form-data; name="description"
test description
------------ThIs_Is_tHe_bouNdaRY_$
Content-Disposition: form-data; name="price"
25
------------ThIs_Is_tHe_bouNdaRY_$
Content-Disposition: form-data; name="quantity"
1
------------ThIs_Is_tHe_bouNdaRY_$
Content-Disposition: form-data; name="shipping_template_id"
7271435
------------ThIs_Is_tHe_bouNdaRY_$
Content-Disposition: form-data; name="title"
test title
------------ThIs_Is_tHe_bouNdaRY_$
Content-Disposition: form-data; name="oauth_body_hash"
RvkuvCKWTfSNobGaypnRskgpPwo%3D
------------ThIs_Is_tHe_bouNdaRY_$
Content-Disposition: form-data; name="oauth_nonce"
53708996
------------ThIs_Is_tHe_bouNdaRY_$
Content-Disposition: form-data; name="oauth_timestamp"
1323667604
------------ThIs_Is_tHe_bouNdaRY_$
Content-Disposition: form-data; name="oauth_consumer_key"
12xx85u7zyjuolg2lqq9ctqa
------------ThIs_Is_tHe_bouNdaRY_$
Content-Disposition: form-data; name="oauth_signature_method"
HMAC-SHA1
------------ThIs_Is_tHe_bouNdaRY_$
Content-Disposition: form-data; name="oauth_version"
1.0
------------ThIs_Is_tHe_bouNdaRY_$
Content-Disposition: form-data; name="oauth_token"
82aa6eb0dea248fc97b303e7da7635
------------ThIs_Is_tHe_bouNdaRY_$
Content-Disposition: form-data; name="oauth_signature"
SPDSMmWg8Zvgw02lGTh7lZ2Xwqo%3D
------------ThIs_Is_tHe_bouNdaRY_$--
HTTP/1.1 403 Forbidden
Date: Mon, 12 Dec 2011 06:36:30 GMT
Server: Apache
X-Error-Detail:
oauth_problem=parameter_absent&oauth_parameters_absent=oauth_consumer_key&oauth_signature&oauth_signature_method&oauth_nonce&oauth_timestamp&oauth_token
X-Etsy-Request-Uuid: EwheU8ZmjDQO8TAkjtv9Eq81ICLP
Content-Length: 176
X-Cnection: close
Content-Type: text/plain;charset=UTF-8
oauth_problem=parameter_absent&oauth_parameters_absent=oauth_consumer_key&oauth_signature&oauth_signature_method&oauth_nonce&oauth_timestamp&oauth_token
In my previous message this line in the header was cut, but in the
POST I did, its there:
authorization: OAuth realm="http://openapi.etsy.com",
oauth_body_hash="RvkuvCKWTfSNobGaypnRskgpPwo%3D",
oauth_nonce="53708996", oauth_timestamp="1323667604",
oauth_consumer_key="12xx85u7zyjuolg2lqq9ctqa",
oauth_signature_method="HMAC-SHA1", oauth_version="1.0",
oauth_token="82aa6eb0dea248fc97b303e7da7635",
oauth_signature="SPDSMmWg8Zvgw02lGTh7lZ2Xwqo%3D"
The response is still:
HTTP/1.1 403 Forbidden
Date: Mon, 12 Dec 2011 06:45:34 GMT
Server: Apache
X-Error-Detail:
oauth_problem=parameter_absent&oauth_parameters_absent=oauth_consumer_key&oauth_signature&oauth_signature_method&oauth_nonce&oauth_timestamp&oauth_token
X-Etsy-Request-Uuid: FS9uUXnDDbP7FLVyM3cZJGCFHt23
--
You received this message because you are subscribed to the Google Groups "Etsy API V2" group.
To post to this group, send email to etsy-...@googlegroups.com.
To unsubscribe from this group, send email to etsy-api-v2...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/etsy-api-v2?hl=en.