pyspiget


Namepyspiget JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/Mark7888/pyspiget
SummarySimple Python wrapper for the Spiget API
upload_time2024-11-23 19:27:18
maintainerNone
docs_urlNone
authorMark7888
requires_python>=3
licenseNone
keywords spiget spigot minecraft api wrapper plugins resources
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![publish](https://github.com/Mark7888/pyspiget/actions/workflows/publish.yml/badge.svg?event=push)](https://github.com/Mark7888/pyspiget/actions/workflows/publish.yml)
[![Downloads](https://static.pepy.tech/badge/pyspiget)](https://pepy.tech/project/pyspiget)

# Python Spiget API Wrapper

A modern Python wrapper for the [Spiget API](https://spiget.org/), providing easy access to Spigot resources, authors, and categories.

## Installation

```bash
pip install pyspiget
```

## Quick Start

```python
from spiget import Spiget

# Initialize the client
api = Spiget(user_agent="MyApp/1.0.0")

# Get a resource
resource = api.get_resource(1234)
print(f"Resource name: {resource.name}")

# Search for resources
resources = api.search_resources("worldedit")
for resource in resources:
    print(f"Found: {resource.name}")
```

## API Reference

### Main Classes

#### `Spiget`

The main class for interacting with the Spiget API.

```python
api = Spiget(user_agent="MyApp/1.0.0")
```

#### `WebhookHandler`

Handles webhook-related operations for the Spiget API.

```python
webhook_handler = WebhookHandler(api.session)
```

### Data Models

All models inherit from `BaseModel` which provides basic dictionary to object conversion.

#### `Resource`
Represents a Spigot resource (plugin, mod, etc.)

Properties:
- `id`: Resource ID
- `name`: Resource name
- `tag`: Resource tag
- `contributors`: List of contributors
- `likes`: Number of likes
- `file`: ResourceFile object
- `tested_versions`: List of tested Minecraft versions
- `links`: Dictionary of related links
- `rating`: ResourceRating object
- `release_date`: Release datetime
- `update_date`: Last update datetime
- `downloads`: Number of downloads
- `external`: Whether the resource is external
- `icon`: Icon object
- `premium`: Whether the resource is premium
- `price`: Resource price (if premium)
- `currency`: Price currency
- `description`: Resource description
- `documentation`: Resource documentation
- `source_code_link`: Link to source code
- `donation_link`: Link to donation page

#### `ResourceFile`
Represents a resource's downloadable file.

Properties:
- `type`: File type
- `size`: File size
- `size_unit`: Size unit
- `url`: Download URL
- `external_url`: External download URL

#### `ResourceVersion`
Represents a specific version of a resource.

Properties:
- `id`: Version ID
- `uuid`: Version UUID
- `name`: Version name
- `release_date`: Release datetime
- `downloads`: Number of downloads
- `rating`: ResourceRating object

#### `ResourceUpdate`
Represents an update post for a resource.

Properties:
- `id`: Update ID
- `resource`: Resource ID
- `title`: Update title
- `description`: Update description
- `date`: Update datetime
- `likes`: Number of likes

#### `ResourceReview`
Represents a review for a resource.

Properties:
- `author`: Author object
- `rating`: ResourceRating object
- `message`: Review message
- `response_message`: Author's response
- `version`: Version reviewed
- `date`: Review datetime

#### `Author`
Represents a resource author.

Properties:
- `id`: Author ID
- `name`: Author name
- `icon`: Icon object

#### `Category`
Represents a resource category.

Properties:
- `id`: Category ID
- `name`: Category name

### Methods

#### Resource Methods

```python
# Get multiple resources
resources = api.get_resources(size=10, page=1, sort=None, fields=None)

# Get a single resource
resource = api.get_resource(resource_id=1234)

# Get resource versions
versions = api.get_resource_versions(resource_id=1234, size=10, page=1)

# Get specific version
version = api.get_resource_version(resource_id=1234, version_id="1.0.0")

# Get latest version
latest = api.get_resource_latest_version(resource_id=1234)

# Get resource updates
updates = api.get_resource_updates(resource_id=1234, size=10, page=1)

# Get resource reviews
reviews = api.get_resource_reviews(resource_id=1234, size=10, page=1)

# Get resource author
author = api.get_resource_author(resource_id=1234)
```

#### Author Methods

```python
# Get multiple authors
authors = api.get_authors(size=10, page=1)

# Get single author
author = api.get_author(author_id=1234)

# Get author's resources
resources = api.get_author_resources(author_id=1234, size=10, page=1)
```

#### Category Methods

```python
# Get all categories
categories = api.get_categories(size=10, page=1)

# Get single category
category = api.get_category(category_id=1234)

# Get category resources
resources = api.get_category_resources(category_id=1234, size=10, page=1)
```

#### Search Methods

```python
# Search resources
resources = api.search_resources(query="worldedit", field=None, size=10, page=1)

# Search authors
authors = api.search_authors(query="sk89q", field=None, size=10, page=1)
```

#### Webhook Methods

```python
# Get available webhook events
events = webhook_handler.get_webhook_events()

# Register a webhook
webhook = webhook_handler.register_webhook(
    url="https://example.com/webhook",
    events=["resource-update", "new-resource"]
)

# Get webhook status
status = webhook_handler.get_webhook_status(webhook_id="abc123")

# Delete webhook
webhook_handler.delete_webhook(webhook_id="abc123", secret="webhook_secret")
```

## Error Handling

The wrapper includes a custom `SpigetError` exception that is raised when API requests fail:

```python
from spiget import Spiget, SpigetError

api = Spiget()

try:
    resource = api.get_resource(99999999)
except SpigetError as e:
    print(f"API error: {e}")
```

## Credits

This wrapper is built for the [Spiget API](https://spiget.org/) created by the [SpiGetOrg team](https://github.com/SpiGetOrg).

## License

MIT License - see LICENSE file for details

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Mark7888/pyspiget",
    "name": "pyspiget",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3",
    "maintainer_email": null,
    "keywords": "spiget, spigot, minecraft, api, wrapper, plugins, resources",
    "author": "Mark7888",
    "author_email": "l.mark7888@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/fe/97/c38c67b96176067eefc96776199625999a3ae09142a014b2ee70ac8747c3/pyspiget-1.0.0.tar.gz",
    "platform": null,
    "description": "[![publish](https://github.com/Mark7888/pyspiget/actions/workflows/publish.yml/badge.svg?event=push)](https://github.com/Mark7888/pyspiget/actions/workflows/publish.yml)\n[![Downloads](https://static.pepy.tech/badge/pyspiget)](https://pepy.tech/project/pyspiget)\n\n# Python Spiget API Wrapper\n\nA modern Python wrapper for the [Spiget API](https://spiget.org/), providing easy access to Spigot resources, authors, and categories.\n\n## Installation\n\n```bash\npip install pyspiget\n```\n\n## Quick Start\n\n```python\nfrom spiget import Spiget\n\n# Initialize the client\napi = Spiget(user_agent=\"MyApp/1.0.0\")\n\n# Get a resource\nresource = api.get_resource(1234)\nprint(f\"Resource name: {resource.name}\")\n\n# Search for resources\nresources = api.search_resources(\"worldedit\")\nfor resource in resources:\n    print(f\"Found: {resource.name}\")\n```\n\n## API Reference\n\n### Main Classes\n\n#### `Spiget`\n\nThe main class for interacting with the Spiget API.\n\n```python\napi = Spiget(user_agent=\"MyApp/1.0.0\")\n```\n\n#### `WebhookHandler`\n\nHandles webhook-related operations for the Spiget API.\n\n```python\nwebhook_handler = WebhookHandler(api.session)\n```\n\n### Data Models\n\nAll models inherit from `BaseModel` which provides basic dictionary to object conversion.\n\n#### `Resource`\nRepresents a Spigot resource (plugin, mod, etc.)\n\nProperties:\n- `id`: Resource ID\n- `name`: Resource name\n- `tag`: Resource tag\n- `contributors`: List of contributors\n- `likes`: Number of likes\n- `file`: ResourceFile object\n- `tested_versions`: List of tested Minecraft versions\n- `links`: Dictionary of related links\n- `rating`: ResourceRating object\n- `release_date`: Release datetime\n- `update_date`: Last update datetime\n- `downloads`: Number of downloads\n- `external`: Whether the resource is external\n- `icon`: Icon object\n- `premium`: Whether the resource is premium\n- `price`: Resource price (if premium)\n- `currency`: Price currency\n- `description`: Resource description\n- `documentation`: Resource documentation\n- `source_code_link`: Link to source code\n- `donation_link`: Link to donation page\n\n#### `ResourceFile`\nRepresents a resource's downloadable file.\n\nProperties:\n- `type`: File type\n- `size`: File size\n- `size_unit`: Size unit\n- `url`: Download URL\n- `external_url`: External download URL\n\n#### `ResourceVersion`\nRepresents a specific version of a resource.\n\nProperties:\n- `id`: Version ID\n- `uuid`: Version UUID\n- `name`: Version name\n- `release_date`: Release datetime\n- `downloads`: Number of downloads\n- `rating`: ResourceRating object\n\n#### `ResourceUpdate`\nRepresents an update post for a resource.\n\nProperties:\n- `id`: Update ID\n- `resource`: Resource ID\n- `title`: Update title\n- `description`: Update description\n- `date`: Update datetime\n- `likes`: Number of likes\n\n#### `ResourceReview`\nRepresents a review for a resource.\n\nProperties:\n- `author`: Author object\n- `rating`: ResourceRating object\n- `message`: Review message\n- `response_message`: Author's response\n- `version`: Version reviewed\n- `date`: Review datetime\n\n#### `Author`\nRepresents a resource author.\n\nProperties:\n- `id`: Author ID\n- `name`: Author name\n- `icon`: Icon object\n\n#### `Category`\nRepresents a resource category.\n\nProperties:\n- `id`: Category ID\n- `name`: Category name\n\n### Methods\n\n#### Resource Methods\n\n```python\n# Get multiple resources\nresources = api.get_resources(size=10, page=1, sort=None, fields=None)\n\n# Get a single resource\nresource = api.get_resource(resource_id=1234)\n\n# Get resource versions\nversions = api.get_resource_versions(resource_id=1234, size=10, page=1)\n\n# Get specific version\nversion = api.get_resource_version(resource_id=1234, version_id=\"1.0.0\")\n\n# Get latest version\nlatest = api.get_resource_latest_version(resource_id=1234)\n\n# Get resource updates\nupdates = api.get_resource_updates(resource_id=1234, size=10, page=1)\n\n# Get resource reviews\nreviews = api.get_resource_reviews(resource_id=1234, size=10, page=1)\n\n# Get resource author\nauthor = api.get_resource_author(resource_id=1234)\n```\n\n#### Author Methods\n\n```python\n# Get multiple authors\nauthors = api.get_authors(size=10, page=1)\n\n# Get single author\nauthor = api.get_author(author_id=1234)\n\n# Get author's resources\nresources = api.get_author_resources(author_id=1234, size=10, page=1)\n```\n\n#### Category Methods\n\n```python\n# Get all categories\ncategories = api.get_categories(size=10, page=1)\n\n# Get single category\ncategory = api.get_category(category_id=1234)\n\n# Get category resources\nresources = api.get_category_resources(category_id=1234, size=10, page=1)\n```\n\n#### Search Methods\n\n```python\n# Search resources\nresources = api.search_resources(query=\"worldedit\", field=None, size=10, page=1)\n\n# Search authors\nauthors = api.search_authors(query=\"sk89q\", field=None, size=10, page=1)\n```\n\n#### Webhook Methods\n\n```python\n# Get available webhook events\nevents = webhook_handler.get_webhook_events()\n\n# Register a webhook\nwebhook = webhook_handler.register_webhook(\n    url=\"https://example.com/webhook\",\n    events=[\"resource-update\", \"new-resource\"]\n)\n\n# Get webhook status\nstatus = webhook_handler.get_webhook_status(webhook_id=\"abc123\")\n\n# Delete webhook\nwebhook_handler.delete_webhook(webhook_id=\"abc123\", secret=\"webhook_secret\")\n```\n\n## Error Handling\n\nThe wrapper includes a custom `SpigetError` exception that is raised when API requests fail:\n\n```python\nfrom spiget import Spiget, SpigetError\n\napi = Spiget()\n\ntry:\n    resource = api.get_resource(99999999)\nexcept SpigetError as e:\n    print(f\"API error: {e}\")\n```\n\n## Credits\n\nThis wrapper is built for the [Spiget API](https://spiget.org/) created by the [SpiGetOrg team](https://github.com/SpiGetOrg).\n\n## License\n\nMIT License - see LICENSE file for details\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Simple Python wrapper for the Spiget API",
    "version": "1.0.0",
    "project_urls": {
        "Bug Reports": "https://github.com/Mark7888/pyspiget/issues",
        "Documentation": "https://github.com/Mark7888/pyspiget/blob/master/README.md",
        "Homepage": "https://github.com/Mark7888/pyspiget",
        "Source Code": "https://github.com/Mark7888/pyspiget"
    },
    "split_keywords": [
        "spiget",
        " spigot",
        " minecraft",
        " api",
        " wrapper",
        " plugins",
        " resources"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d0cb65fc48b8e69a13bfef93ca18608321b3adbe6d4ebb05d56b71c47e70dcec",
                "md5": "bf7f30545bcc9ddd6bea5dcdcd9a56ae",
                "sha256": "431cd40de212dd038ad0f62f73c1a860ba56f473f9c052697e45a130a6fc9ae5"
            },
            "downloads": -1,
            "filename": "pyspiget-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bf7f30545bcc9ddd6bea5dcdcd9a56ae",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3",
            "size": 6905,
            "upload_time": "2024-11-23T19:27:16",
            "upload_time_iso_8601": "2024-11-23T19:27:16.687340Z",
            "url": "https://files.pythonhosted.org/packages/d0/cb/65fc48b8e69a13bfef93ca18608321b3adbe6d4ebb05d56b71c47e70dcec/pyspiget-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fe97c38c67b96176067eefc96776199625999a3ae09142a014b2ee70ac8747c3",
                "md5": "bc62a5d859a84bf77330caad1f6ab3c5",
                "sha256": "333f6543e7060da247305d3ec124dc9205e97bcfde5420e4a08b8eaa33cb44fc"
            },
            "downloads": -1,
            "filename": "pyspiget-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "bc62a5d859a84bf77330caad1f6ab3c5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3",
            "size": 12032,
            "upload_time": "2024-11-23T19:27:18",
            "upload_time_iso_8601": "2024-11-23T19:27:18.528374Z",
            "url": "https://files.pythonhosted.org/packages/fe/97/c38c67b96176067eefc96776199625999a3ae09142a014b2ee70ac8747c3/pyspiget-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-23 19:27:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Mark7888",
    "github_project": "pyspiget",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pyspiget"
}
        
Elapsed time: 1.09810s