ETSY API v3 Client
Project description
Etsy3Py
Client for Etsy API v3
Installation
You can install etsy3py using pip:
pip install etsy3py
Requirements
Python 3.6 or higher.
Etsy API
This is a Python client for the Etsy API. The client makes it easy to interact with the Etsy API and perform operations on a user's behalf.
Usage
To use the EtsyApi class, you will need to obtain an access token from the Etsy API.
from etsy3py.v3 import EtsyApi
access_token = "YOUR_ACCESS_TOKEN"
client_id = "YOUR_CLIENT_ID"
etsy_api = EtsyApi(access_token=access_token, client_id=client_id)
listing_id = 12345
listing = etsy_api.get_listing(listing_id)
Authentication
The EtsyApi class uses OAuth 2.0 authentication. You will need to obtain an access token from the Etsy API before using the client. You can obtain an access token by following the instructions in the Etsy API documentation.
Rate Limiting
The Etsy API has a rate limiting policy that limits the number of requests that can be made in a given time period.
Authentication step-by-step
EtsyOAuthClient
is a Python class that provides an authentication client for the Etsy marketplace API,
allowing users to connect to the API using OAuth2 authentication.
Usage
Here is an example of how to use the EtsyOAuthClient to obtain an access token from the Etsy API.
from etsy3py.oauth import EtsyOAuthClient
Replace these with your own values from the Etsy Developer Console
client_id = 'your_client_id'
client_secret = 'your_client_secret'
redirect_uri = 'your_redirect_uri'
scope = ['your_scope_1', 'your_scope_2', ...]
Create an instance of the EtsyOAuthClient
client = EtsyOAuthClient(client_id, client_secret, redirect_uri, scope)
Get the authorization URL
authorization_url, state = client.authorization_url()
Redirect the user to the authorization URL to grant access. Once the user has granted access, get the authorization code and use it to obtain an access token
authorization_code = 'the_authorization_code'
access_token = client.fetch_token(authorization_code)
You can now use the access token to make requests to the Etsy API
Refresh token
The refresh_token
method of the EtsyOAuthClient
class requests a new access token from the authorization server using a refresh token.
Parameters
refresh_token
(required): The refresh token used to obtain a new access token.
Return Value
The refresh_token
method returns a dictionary containing the new access token and any additional data returned by the authorization server.
Usage
Replace these with your own values from the Etsy Developer Console
client_id = 'your_client_id'
client_secret = 'your_client_secret'
# create an instance of the EtsyOAuthClient
client = EtsyOAuthClient(client_id, client_secret)
# if the access token expires, you can use the refresh token to obtain a new access token and additional data
new_access_token = client.refresh_token(refresh_token)
This package is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file etsy3py-0.0.3.tar.gz
.
File metadata
- Download URL: etsy3py-0.0.3.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | abcae1d2fd2c2c4ee4af22d7dd1de59b5b170e1b5918b0e12bc9255d84eb6f1f |
|
MD5 | 470fb8c00368f4d90609bd4dab59ede2 |
|
BLAKE2b-256 | 0531ebe5747a7ed1967ca04f30e1d659883c6cb46d29245b598b26e2363099dc |