pypexel


Namepypexel JSON
Version 0.0.2 PyPI version JSON
download
home_pageNone
SummaryAsync Object-oriented Python SDK for the Pexels API.
upload_time2025-07-10 00:37:14
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseMIT License
keywords pexels sdk async images videos
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center" markdown>
<img src="https://github.com/iwatkot/pypexel/releases/download/0.0.1/poster.png">

Async Object-oriented Python SDK for the Pexels API.

<p align="center">
    <a href="#Overview">Overview</a> •
    <a href="#Quick-Start">Quick Start</a> •
    <a href="#Examples">Examples</a> •
    <a href="#Bugs-and-Feature-Requests">Bugs and Feature Requests</a> •
    <a href="https://pypi.org/project/pypexel/">PyPI</a>
</p>

[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/iwatkot/pypexel)](https://github.com/iwatkot/pypexel/releases)
[![PyPI - Version](https://img.shields.io/pypi/v/pypexel)](https://pypi.org/project/pypexel/)
[![GitHub issues](https://img.shields.io/github/issues/iwatkot/pypexel)](https://github.com/iwatkot/pypexel/issues)
[![Build Status](https://github.com/iwatkot/pypexel/actions/workflows/checks.yml/badge.svg)](https://github.com/iwatkot/pypexel/actions)
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)<br>
[![PyPI - Downloads](https://img.shields.io/pypi/dm/pypexel)](https://pypi.org/project/pypexel/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pypexel)](https://pypi.org/project/pypexel/)
[![codecov](https://codecov.io/github/iwatkot/pypexel/graph/badge.svg?token=M9EYR3D23P)](https://codecov.io/github/iwatkot/pypexel)

</div>

## Overview
This SDK is designed to interact with the [Pexels API](https://www.pexels.com/api/) in a more object-oriented way. It provides asynchronous methods to interact with the API. The SDK is designed to be as simple as possible to use, while still providing a lot of flexibility and uses `Pydantic` models to validate the data.<br>
Used dependencies:
- `httpx` for asynchronous API
- `pydantic` for models

Supported Python versions:
- 3.11
- 3.12

## Quick Start
After installing the SDK, you can create a new instance of the API. When creating a new instance, you can either use environment variables or pass the credentials directly. It's strongly recommended to use environment variables to store the API credentials.<br>

### Installation
```bash
pip install pypexel
```

### Create a new instance of the API
It's recommended to use an environment variable to store the API credentials:
```python
import os

os.environ["PEXELS_API_KEY"] = "your-api-key"
```

To work asynchronously:
```python
import pypexel as pex

# Using environment variables:
api = pex.AsyncApi.from_env()

# Or using the credentials directly:
api = pex.AsyncApi("your-api-key")
```

## Examples
You'll find detailed docs with usage examples for both APIs and for used models in the corresponding package directories:
- [Asynchronous API](pypexel/async_api/README.md)
- [Models](pypexel/models/README.md)

In this section, you'll find some examples of how to use the SDK. You can also check out the [demo.py](demo.py) file in the root directory for more examples.

### Search for photos
```python
import asyncio
import os
import pypexel as pex

os.environ["PEXELS_API_KEY"] = "your-api-key"

api = pex.AsyncApi.from_env()

async def main():
    # Search for photos with the query "nature"
    photos = await api.photos.search("nature", limit=10)
    
    # Print the first photo's URL
    if photos:
        print(photos[0].src.original)
    else:
        print("No photos found.")

asyncio.run(main())
```

### Search for videos
```python
import asyncio
import os
import pypexel as pex

os.environ["PEXELS_API_KEY"] = "your-api-key"
api = pex.AsyncApi.from_env()

async def main():
    # Search for videos with the query "nature"
    videos = await api.videos.search("nature", limit=10)
    
    # Print the first video URL
    if videos:
        print(videos[0].video_files[0].link)
    else:
        print("No videos found.")

asyncio.run(main())
```

## Bugs and Feature Requests
If you find a bug or have a feature request, please open an issue on the GitHub repository.<br>
You're also welcome to contribute to the project by opening a pull request.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pypexel",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "pexels, sdk, async, images, videos",
    "author": null,
    "author_email": "iwatkot <iwatkot@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/9e/7e/bfe32993a3e2931da7f43c1d9185fc6675de88bb4dcccaddaa4aa2afce0e/pypexel-0.0.2.tar.gz",
    "platform": null,
    "description": "<div align=\"center\" markdown>\n<img src=\"https://github.com/iwatkot/pypexel/releases/download/0.0.1/poster.png\">\n\nAsync Object-oriented Python SDK for the Pexels API.\n\n<p align=\"center\">\n    <a href=\"#Overview\">Overview</a> \u2022\n    <a href=\"#Quick-Start\">Quick Start</a> \u2022\n    <a href=\"#Examples\">Examples</a> \u2022\n    <a href=\"#Bugs-and-Feature-Requests\">Bugs and Feature Requests</a> \u2022\n    <a href=\"https://pypi.org/project/pypexel/\">PyPI</a>\n</p>\n\n[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/iwatkot/pypexel)](https://github.com/iwatkot/pypexel/releases)\n[![PyPI - Version](https://img.shields.io/pypi/v/pypexel)](https://pypi.org/project/pypexel/)\n[![GitHub issues](https://img.shields.io/github/issues/iwatkot/pypexel)](https://github.com/iwatkot/pypexel/issues)\n[![Build Status](https://github.com/iwatkot/pypexel/actions/workflows/checks.yml/badge.svg)](https://github.com/iwatkot/pypexel/actions)\n[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)<br>\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/pypexel)](https://pypi.org/project/pypexel/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pypexel)](https://pypi.org/project/pypexel/)\n[![codecov](https://codecov.io/github/iwatkot/pypexel/graph/badge.svg?token=M9EYR3D23P)](https://codecov.io/github/iwatkot/pypexel)\n\n</div>\n\n## Overview\nThis SDK is designed to interact with the [Pexels API](https://www.pexels.com/api/) in a more object-oriented way. It provides asynchronous methods to interact with the API. The SDK is designed to be as simple as possible to use, while still providing a lot of flexibility and uses `Pydantic` models to validate the data.<br>\nUsed dependencies:\n- `httpx` for asynchronous API\n- `pydantic` for models\n\nSupported Python versions:\n- 3.11\n- 3.12\n\n## Quick Start\nAfter installing the SDK, you can create a new instance of the API. When creating a new instance, you can either use environment variables or pass the credentials directly. It's strongly recommended to use environment variables to store the API credentials.<br>\n\n### Installation\n```bash\npip install pypexel\n```\n\n### Create a new instance of the API\nIt's recommended to use an environment variable to store the API credentials:\n```python\nimport os\n\nos.environ[\"PEXELS_API_KEY\"] = \"your-api-key\"\n```\n\nTo work asynchronously:\n```python\nimport pypexel as pex\n\n# Using environment variables:\napi = pex.AsyncApi.from_env()\n\n# Or using the credentials directly:\napi = pex.AsyncApi(\"your-api-key\")\n```\n\n## Examples\nYou'll find detailed docs with usage examples for both APIs and for used models in the corresponding package directories:\n- [Asynchronous API](pypexel/async_api/README.md)\n- [Models](pypexel/models/README.md)\n\nIn this section, you'll find some examples of how to use the SDK. You can also check out the [demo.py](demo.py) file in the root directory for more examples.\n\n### Search for photos\n```python\nimport asyncio\nimport os\nimport pypexel as pex\n\nos.environ[\"PEXELS_API_KEY\"] = \"your-api-key\"\n\napi = pex.AsyncApi.from_env()\n\nasync def main():\n    # Search for photos with the query \"nature\"\n    photos = await api.photos.search(\"nature\", limit=10)\n    \n    # Print the first photo's URL\n    if photos:\n        print(photos[0].src.original)\n    else:\n        print(\"No photos found.\")\n\nasyncio.run(main())\n```\n\n### Search for videos\n```python\nimport asyncio\nimport os\nimport pypexel as pex\n\nos.environ[\"PEXELS_API_KEY\"] = \"your-api-key\"\napi = pex.AsyncApi.from_env()\n\nasync def main():\n    # Search for videos with the query \"nature\"\n    videos = await api.videos.search(\"nature\", limit=10)\n    \n    # Print the first video URL\n    if videos:\n        print(videos[0].video_files[0].link)\n    else:\n        print(\"No videos found.\")\n\nasyncio.run(main())\n```\n\n## Bugs and Feature Requests\nIf you find a bug or have a feature request, please open an issue on the GitHub repository.<br>\nYou're also welcome to contribute to the project by opening a pull request.\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Async Object-oriented Python SDK for the Pexels API.",
    "version": "0.0.2",
    "project_urls": {
        "Homepage": "https://github.com/iwatkot/pypexel",
        "Repository": "https://github.com/iwatkot/pypexel"
    },
    "split_keywords": [
        "pexels",
        " sdk",
        " async",
        " images",
        " videos"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1fc92dd72303aaba67eb3df1e5de42b7eaec265d230aa5f09d3dbfab2f3e68aa",
                "md5": "c5b646e689e1cb42706231bf59a721bf",
                "sha256": "cac89096b140a625d465ff541c771b2c88b2599373b3fc2e77b03319b218c477"
            },
            "downloads": -1,
            "filename": "pypexel-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c5b646e689e1cb42706231bf59a721bf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 12142,
            "upload_time": "2025-07-10T00:37:13",
            "upload_time_iso_8601": "2025-07-10T00:37:13.004880Z",
            "url": "https://files.pythonhosted.org/packages/1f/c9/2dd72303aaba67eb3df1e5de42b7eaec265d230aa5f09d3dbfab2f3e68aa/pypexel-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9e7ebfe32993a3e2931da7f43c1d9185fc6675de88bb4dcccaddaa4aa2afce0e",
                "md5": "d44d8fe706c4d808e5dbdff6c4ad27f3",
                "sha256": "7b74b52b7475b30f532a9fb1a96117d03285f0f4c40b9451778ac0d143c39251"
            },
            "downloads": -1,
            "filename": "pypexel-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "d44d8fe706c4d808e5dbdff6c4ad27f3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 10982,
            "upload_time": "2025-07-10T00:37:14",
            "upload_time_iso_8601": "2025-07-10T00:37:14.150628Z",
            "url": "https://files.pythonhosted.org/packages/9e/7e/bfe32993a3e2931da7f43c1d9185fc6675de88bb4dcccaddaa4aa2afce0e/pypexel-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-10 00:37:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "iwatkot",
    "github_project": "pypexel",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pypexel"
}
        
Elapsed time: 1.70173s