Skip to main content

An auto-updating Etsy Wrapper

Project description

EtsyPy ~ The only working Etsy API wrapper!

This wrapper auto-generates itself from the API spec provided by Etsy at openapi.etsy.com/v2/

Instead of generating at runtime, it generates itself as the API changes through a set of Github Actions, this means you need to be sure to keep it up to date! You can check if you are up to date by calling {{packagename}}.need_update()

^^^ Planning to implement two update categories, with ones that effect large programmatic changes raising a separate exception to simple method table updates.

By pre-generating the API, this wrapper can take advantage of the typing module, and stub files to provide autocomplete. Hints for Etsy parameters are planned.

Basic Usage:

import {{packagename}}

# EtsyPy uses pluggable Requesters, that handle authentication, and pre-processing of requests.
# When initializing the Requester, you must specify the authentication mode:
# oauth_1 | api_key
# api_key authentication mode:

requester = {{packagename}}.rq.EtsyRequester(
	auth_mode="api_key",
    api_key="$token",
    api_base_url="https://openapi.etsy.com/v2" # <-- Without the trailing slash! (is default)
)

# Oauth 1 authentication mode: <-- Still being figured out, may change aggressively between updates!

oauth_credentials = {{packagename}}.rq.EtsyOauthCredentials(
	client_key="$api_key",
    client_secret="$shared_secret",
    resource_owner_key="$oauth_token",
    resource_owner_secret="$oauth_token_secret"
) # For help getting these credentials, scroll down to the Oauth Helper section.

requester = {{packagename}}.rq.EtsyRequester(
	auth_mode="oauth_1",
    oauth_credentials=oauth_credentials
)

# Now we initialise a client.

etsy_client = {{packagename}}.client.EtsyClient(requester)

# With this client you can call any API method, e.g.

etsy_client.findAllFeaturedListings() # <-- You can find these names listed on the Etsy Documentation.

# URL arguments, like /listings/:listing_id, should be passed into their
# respective methods as positional arguments, in the order that they appear.
# They will be URL-Encoded automatically, but must be passed in as strings.
etsy_client.getListing("$listing_id")

# Query parameters should be passed into their respective methods as a
# dictionary, through the query_params keyword argument.
etsy_client.findAllFeaturedListings(query_params={
    "limit": 25,
    "offset": 2,
    "page": 6,
})

# POST and PUT requests that contain JSON data should be passed into methods
# through the data kwarg.

# ^^^ I expect problems to arise converting objects, if you find a problem
# please submit an issue.

etsy_client.updateListing("$listing_id", data={
    "title": "$product_title",
})

# If a request fails to complete for technical reasons, it will raise its expected
# exception from the requests library, however if Etsy returns a failed status code, the
# response object will return false on its .ok() method.

# Requests return an rq.EtsyResponse object, with the standard requests.Response object contained within.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

etsy-py-dev-0.0.2.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

etsy_py_dev-0.0.2-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file etsy-py-dev-0.0.2.tar.gz.

File metadata

  • Download URL: etsy-py-dev-0.0.2.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for etsy-py-dev-0.0.2.tar.gz
Algorithm Hash digest
SHA256 369441da5274711d2182cf293173d48067faa67c04445e8680a7211beb1d4388
MD5 9198ead3a314e8d4438b7d23f3fad87e
BLAKE2b-256 e0b061ff00d61ab3fbedff022c14b060b3a11c24caee3f0be5640bc445bd09b0

See more details on using hashes here.

File details

Details for the file etsy_py_dev-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: etsy_py_dev-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for etsy_py_dev-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5712fe98b971fa313e7a1a665b8f1612b8f9119ab8584cb3dea64f5a061a00f7
MD5 0c6a3a7224e3c40e2fc07bb43445b4b8
BLAKE2b-256 c30f1b6985bae809d06325e9392b4e3dd9bd66cec00439309875b06805ba89d0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page