restocks-client


Namerestocks-client JSON
Version 0.1.2 PyPI version JSON
download
home_page
SummaryRestocks.net client for Python.
upload_time2022-12-30 11:38:28
maintainer
docs_urlNone
authorbanjo
requires_python
licenseMIT
keywords python client
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Installation
```
pip install restocks-client
```

# Introduction
You can search for products without being logged in, however, there are some client methods which require you to be logged in to your Restocks.net account to be used.

You can either use the client with or without proxies. Proxies will rotate for each client call for those methods which do not require login. The same proxy will be used for all the client calls after you log in if you decide to do so.

| Method  | Description | Login |
| ------------- | ------------- | :-------------: |
| `search_products`  | Searches for products. | NO |
| `get_product`  | Gets all the data of an specific product. | NO |
| `get_size_lowest_price` | Gets the lowest price of a product size. | YES |
| `get_sales_history` | Gets the account sold products. | YES |
| `get_listings_history` | Gets the account current product listings. | YES |
| `list_product` | Lists a product for sale. | YES |
| `edit_listing` | Edits a product listing. | YES |
| `delete_listing` | Deletes a product listing. | YES |

# Example

```python
from restocks.client import Client
from restocks.filters import SellMethod, ListingDuration


proxy = {"https": "https://username:password@ip:port"} 
# or optionally
proxy = [{"https": "https://username:password@ip:port"}, {"https": "https://username:password@ip:port"}]

client = Client(proxy=proxy)


# ---- Get product data ---------------------- #

product = client.get_product("DD1391-100")

print(product.name, product.sku)

# -------------------------------------------- #


# ---- Log in to your Restocks.net account --- #

username = "YOUR_USERNAME"
password = "YOUR_PASSWORD"

client.login(username, password)

# -------------------------------------------- #


# ---- Get the account sales ----------------- #

sales = client.get_sales_history()

for sale in sales:
    
    print(sale.name, sale.price, sale.date)
    
# -------------------------------------------- #


# ---- List a product for sale --------------- #

listed = client.list_product(
    product=product, # DD1391-100
    store_price=3000,
    size="42",
    sell_method=SellMethod.Resell,
    duration=ListingDuration.Days60
)

print(listed)

# -------------------------------------------- #
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "restocks-client",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python,client",
    "author": "banjo",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/25/eb/970276c79f2e9bad252b61463de9cbd57452067522fff5193f6e8f621a9c/restocks-client-0.1.2.tar.gz",
    "platform": null,
    "description": "# Installation\n```\npip install restocks-client\n```\n\n# Introduction\nYou can search for products without being logged in, however, there are some client methods which require you to be logged in to your Restocks.net account to be used.\n\nYou can either use the client with or without proxies. Proxies will rotate for each client call for those methods which do not require login. The same proxy will be used for all the client calls after you log in if you decide to do so.\n\n| Method  | Description | Login |\n| ------------- | ------------- | :-------------: |\n| `search_products`  | Searches for products. | NO |\n| `get_product`  | Gets all the data of an specific product. | NO |\n| `get_size_lowest_price` | Gets the lowest price of a product size. | YES |\n| `get_sales_history` | Gets the account sold products. | YES |\n| `get_listings_history` | Gets the account current product listings. | YES |\n| `list_product` | Lists a product for sale. | YES |\n| `edit_listing` | Edits a product listing. | YES |\n| `delete_listing` | Deletes a product listing. | YES |\n\n# Example\n\n```python\nfrom restocks.client import Client\nfrom restocks.filters import SellMethod, ListingDuration\n\n\nproxy = {\"https\": \"https://username:password@ip:port\"} \n# or optionally\nproxy = [{\"https\": \"https://username:password@ip:port\"}, {\"https\": \"https://username:password@ip:port\"}]\n\nclient = Client(proxy=proxy)\n\n\n# ---- Get product data ---------------------- #\n\nproduct = client.get_product(\"DD1391-100\")\n\nprint(product.name, product.sku)\n\n# -------------------------------------------- #\n\n\n# ---- Log in to your Restocks.net account --- #\n\nusername = \"YOUR_USERNAME\"\npassword = \"YOUR_PASSWORD\"\n\nclient.login(username, password)\n\n# -------------------------------------------- #\n\n\n# ---- Get the account sales ----------------- #\n\nsales = client.get_sales_history()\n\nfor sale in sales:\n    \n    print(sale.name, sale.price, sale.date)\n    \n# -------------------------------------------- #\n\n\n# ---- List a product for sale --------------- #\n\nlisted = client.list_product(\n    product=product, # DD1391-100\n    store_price=3000,\n    size=\"42\",\n    sell_method=SellMethod.Resell,\n    duration=ListingDuration.Days60\n)\n\nprint(listed)\n\n# -------------------------------------------- #\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Restocks.net client for Python.",
    "version": "0.1.2",
    "split_keywords": [
        "python",
        "client"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "c0dd28e6b2035e8e55c9f3bd9496510e",
                "sha256": "a1d93f01837169f0046ca382cb7b64d0328ccdee0cf77136393f9fbb5b838ce3"
            },
            "downloads": -1,
            "filename": "restocks_client-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c0dd28e6b2035e8e55c9f3bd9496510e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 10927,
            "upload_time": "2022-12-30T11:38:26",
            "upload_time_iso_8601": "2022-12-30T11:38:26.432379Z",
            "url": "https://files.pythonhosted.org/packages/89/5a/5385467cb61e72e2a8d1af62a1bb27d87f5fdf6d26156f50e012c0cdceae/restocks_client-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "2e2cf7a57d15e6a21f0e65305d53601b",
                "sha256": "fe8ac2c00687b0f24693ec91b2d941b216fe0e999e430a7ddba6bb560ff68130"
            },
            "downloads": -1,
            "filename": "restocks-client-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "2e2cf7a57d15e6a21f0e65305d53601b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 9828,
            "upload_time": "2022-12-30T11:38:28",
            "upload_time_iso_8601": "2022-12-30T11:38:28.443815Z",
            "url": "https://files.pythonhosted.org/packages/25/eb/970276c79f2e9bad252b61463de9cbd57452067522fff5193f6e8f621a9c/restocks-client-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-30 11:38:28",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "restocks-client"
}
        
Elapsed time: 0.02643s