Skip to main content

Wraps the eBay REST APIs.

Project description

ebay_rest

A tread-safe Python 3 pip package that conveniently wraps eBay’s REST APIs.

Installation

Use the package manager pip to install ebay_rest.

pip install ebay_rest    # Use pip3 if your computer happens to also have Python 2 installed.

Setup

Follow the instructions here.

Usage

from ebay_rest import API, DateTime, Error, Reference

print(f"eBay's official date and time is {DateTime.to_string(DateTime.now())}.\n")

print("All valid eBay global id values, also known as site ids.")
print(Reference.get_global_id_values(), '\n')

try:
    api = API(sandbox=False)
except Error as error:
    print(f'Error {error.number} is {error.reason}  {error.detail}.\n')
else:
    try:
        print("The five least expensive iPhone things now for sale on-eBay:")
        for item in api.buy_browse_search(q='iPhone', sort='price', limit=5):
            print(f"item id: {item['item_id']} {item['item_web_url']}")
    except Error as error:
        print(f'Error {error.number} is {error.reason} {error.detail}.\n')
    else:
        pass

print("\nClass documentation:")
print(help(API))    # Over a hundred methods are available!
print(help(DateTime))
print(help(Error))
print(help(Reference))

FAQ | Frequently Asked Questions

Question: How are API results organized?

Answer:

  • Elemental information is stored in dates, integers, strings and other basic built-in types.
  • Dictionaries contain related elements.
  • Lists contain information organized repetitively; expect zero or more contents.
  • Dicts and Lists may be nested.
  • eBay classifies data as optional or mandatory. Optional elements, dicts or lists are omitted. Manditories have a None value.

Q: How to make API calls faster?

A: Prioritized, do the first things first.

  1. Reuse the API object.
  2. Some calls have filtering options; omit unneeded data.
  3. When the call returns a list, make the call in a "for" loop.
  4. Use threading to make calls in parallel but don't exhaust RAM.
  5. Use multiprocessing. -- Multiprocessing support is a future goal. -- A safe workaround is to concurrently run copies of your program and divide the work among each.
  6. Switch to a faster internet connection.
  7. Switch to computer with faster cores.

Q: How are paged calls/results handled?

A: A simple generator is implemented.

  • To be clear, "Paging" is eBay's term for repeating a call while advancing a record offset to get all records.
  • eBay documentation has the word "Page" in the return type of paging calls.
  • Do NOT supply a record "offset" parameter when making a paging call.
  • The "limit" parameter is repurposed to control how many records from the entire set you want.
  • To get all possible records, don't supply a limit.
  • eBay imposes a hard limit on some calls, typically 10,000 records. Use filters to try and keep below the limit. Use try-except to handle going over.
  • Avoid exhausting memory by making the call within a "for" loop.

Contributing

  • Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
  • Error handling. Make a debug logs for maintainers. Throw exceptions for end-user errors.
  • Follow Uncle Bob's SOLID principles; see a text description & video tutorial.
  • Note the error number guide documented in the Error class definition.
  • Please make sure to update tests as appropriate.

Legal

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

ebay_rest-0.0.4.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

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

ebay_rest-0.0.4-py3-none-any.whl (2.2 MB view details)

Uploaded Python 3

File details

Details for the file ebay_rest-0.0.4.tar.gz.

File metadata

  • Download URL: ebay_rest-0.0.4.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.3

File hashes

Hashes for ebay_rest-0.0.4.tar.gz
Algorithm Hash digest
SHA256 3a3fcc088d9d8dda752d84f65385b7acaadf31d1d6e11b8042d036e888418bcf
MD5 c75c7151e4903cc418e6a1572cfd999f
BLAKE2b-256 e0cbbab1a393888e936eb01caa5ceb56490c3c316494c44c73d8d0b8a667f917

See more details on using hashes here.

File details

Details for the file ebay_rest-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: ebay_rest-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.3

File hashes

Hashes for ebay_rest-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8c8b2f6a4fc22c64ee4bc64f0a27d35530cfe8426248c462ab0864f139c9a0a9
MD5 8f8e4b04324f74eb02ef5cd581e6a67a
BLAKE2b-256 d7bbb4fbf0e33aed337a3a50f0b3e7640b60a87aa8334e63b2d8c5b900b5ef45

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