python-memes


Namepython-memes JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryA simple Python package to fetch random memes from Reddit.
upload_time2025-08-28 03:39:44
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2025 Madhav Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords memes reddit fun api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python Meme Fetcher

A simple Python module to fetch random memes from Reddit using the [Meme API](https://meme-api.com/).

## Prerequisites

- Python 3.9+
- [Requests](https://pypi.org/project/requests/) library

## Setup

You can clone the repo through this: 

```bash
git clone https://github.com/Madhav703/python-memes.git
```

1: Open the required directory:

```bash
cd python-memes
```

2. Install dependencies:

```bash
pip install -r requirements.txt
```

Or install directly from PyPI

```bash
pip install python-memes
```

## Usage

```python
from memes import MemeFetcher

# Fetch from any subreddit
mf = MemeFetcher("dankmemes")
meme = mf.get_meme()

if "error" in meme:
    print("Error:", meme["error"])
else:
    print("Title:", meme["title"])
    print("Subreddit:", meme["subreddit"])
    print("URL:", meme["url"])
```

## Discord.py Usage

```python

import discord
from discord.ext import commands
from memes import MemeFetcher

intents = discord.Intents.default()
bot = commands.Bot(command_prefix="!", intents=intents)

@bot.command()
async def meme(ctx):
    mf = MemeFetcher()
    meme = mf.get_meme()

    if "error" in meme:
        await ctx.send(f"⚠️ {meme['error']}")
        return

    embed = discord.Embed(
        title=meme["title"],
        description=f"From r/{meme['subreddit']}",
        color=discord.Color.random()
    )
    embed.set_image(url=meme["url"])
    await ctx.send(embed=embed)

bot.run("YOUR_BOT_TOKEN")

```

## Notes

- Always fetches a random meme from Reddit.

- If the API is down or unreachable, the function returns an error dictionary.

- Requires an active internet connection.

## Troubleshooting

- `requests.exceptions.ConnectionError` → check your internet connection.

- Timeout errors → API might be down; try again later.

- Ensure you have installed the requests package properly.

## Contributing

- Fork this repository and make your changes.

- Run tests to ensure everything works.

- Submit a pull request with a clear description.

## License

- This project is licensed under the MIT License – see the LICENSE
 file for details.

## Facing any Issues?

- You can open an issue on the GitHub repo
.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "python-memes",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "memes, reddit, fun, api",
    "author": null,
    "author_email": "Madhav <kathuriamadhav0703@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/c2/ad/ff311ecded3a1bfeaa6ff6d31eaea30eeafd3334a3828a4fcae136beb7bb/python_memes-0.1.1.tar.gz",
    "platform": null,
    "description": "# Python Meme Fetcher\r\n\r\nA simple Python module to fetch random memes from Reddit using the [Meme API](https://meme-api.com/).\r\n\r\n## Prerequisites\r\n\r\n- Python 3.9+\r\n- [Requests](https://pypi.org/project/requests/) library\r\n\r\n## Setup\r\n\r\nYou can clone the repo through this: \r\n\r\n```bash\r\ngit clone https://github.com/Madhav703/python-memes.git\r\n```\r\n\r\n1: Open the required directory:\r\n\r\n```bash\r\ncd python-memes\r\n```\r\n\r\n2. Install dependencies:\r\n\r\n```bash\r\npip install -r requirements.txt\r\n```\r\n\r\nOr install directly from PyPI\r\n\r\n```bash\r\npip install python-memes\r\n```\r\n\r\n## Usage\r\n\r\n```python\r\nfrom memes import MemeFetcher\r\n\r\n# Fetch from any subreddit\r\nmf = MemeFetcher(\"dankmemes\")\r\nmeme = mf.get_meme()\r\n\r\nif \"error\" in meme:\r\n    print(\"Error:\", meme[\"error\"])\r\nelse:\r\n    print(\"Title:\", meme[\"title\"])\r\n    print(\"Subreddit:\", meme[\"subreddit\"])\r\n    print(\"URL:\", meme[\"url\"])\r\n```\r\n\r\n## Discord.py Usage\r\n\r\n```python\r\n\r\nimport discord\r\nfrom discord.ext import commands\r\nfrom memes import MemeFetcher\r\n\r\nintents = discord.Intents.default()\r\nbot = commands.Bot(command_prefix=\"!\", intents=intents)\r\n\r\n@bot.command()\r\nasync def meme(ctx):\r\n    mf = MemeFetcher()\r\n    meme = mf.get_meme()\r\n\r\n    if \"error\" in meme:\r\n        await ctx.send(f\"\u26a0\ufe0f {meme['error']}\")\r\n        return\r\n\r\n    embed = discord.Embed(\r\n        title=meme[\"title\"],\r\n        description=f\"From r/{meme['subreddit']}\",\r\n        color=discord.Color.random()\r\n    )\r\n    embed.set_image(url=meme[\"url\"])\r\n    await ctx.send(embed=embed)\r\n\r\nbot.run(\"YOUR_BOT_TOKEN\")\r\n\r\n```\r\n\r\n## Notes\r\n\r\n- Always fetches a random meme from Reddit.\r\n\r\n- If the API is down or unreachable, the function returns an error dictionary.\r\n\r\n- Requires an active internet connection.\r\n\r\n## Troubleshooting\r\n\r\n- `requests.exceptions.ConnectionError` \u2192 check your internet connection.\r\n\r\n- Timeout errors \u2192 API might be down; try again later.\r\n\r\n- Ensure you have installed the requests package properly.\r\n\r\n## Contributing\r\n\r\n- Fork this repository and make your changes.\r\n\r\n- Run tests to ensure everything works.\r\n\r\n- Submit a pull request with a clear description.\r\n\r\n## License\r\n\r\n- This project is licensed under the MIT License \u2013 see the LICENSE\r\n file for details.\r\n\r\n## Facing any Issues?\r\n\r\n- You can open an issue on the GitHub repo\r\n.\r\n",
    "bugtrack_url": null,
    "license": "MIT License\r\n        \r\n        Copyright (c) 2025 Madhav\r\n        \r\n        Permission is hereby granted, free of charge, to any person obtaining a copy\r\n        of this software and associated documentation files (the \"Software\"), to deal\r\n        in the Software without restriction, including without limitation the rights\r\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n        copies of the Software, and to permit persons to whom the Software is\r\n        furnished to do so, subject to the following conditions:\r\n        \r\n        The above copyright notice and this permission notice shall be included in all\r\n        copies or substantial portions of the Software.\r\n        \r\n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n        SOFTWARE.\r\n        ",
    "summary": "A simple Python package to fetch random memes from Reddit.",
    "version": "0.1.1",
    "project_urls": null,
    "split_keywords": [
        "memes",
        " reddit",
        " fun",
        " api"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8b8a5c49e45065e5bc2db2ccc25215330633e40e7fe41e643b2d8c9a03add2c9",
                "md5": "10ee143265fd4f96c67f35469951e642",
                "sha256": "a1af716adba5be5552d86969a3e12b52c087f6ca0b0a1369e2007050135598f4"
            },
            "downloads": -1,
            "filename": "python_memes-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "10ee143265fd4f96c67f35469951e642",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 4628,
            "upload_time": "2025-08-28T03:39:43",
            "upload_time_iso_8601": "2025-08-28T03:39:43.111950Z",
            "url": "https://files.pythonhosted.org/packages/8b/8a/5c49e45065e5bc2db2ccc25215330633e40e7fe41e643b2d8c9a03add2c9/python_memes-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c2adff311ecded3a1bfeaa6ff6d31eaea30eeafd3334a3828a4fcae136beb7bb",
                "md5": "f1fdfedc64482aeb18030569ee466328",
                "sha256": "5245df61ab29b2da670158ab8e2490aef355d4aada96f8abb0819705121fbeaa"
            },
            "downloads": -1,
            "filename": "python_memes-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f1fdfedc64482aeb18030569ee466328",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 3769,
            "upload_time": "2025-08-28T03:39:44",
            "upload_time_iso_8601": "2025-08-28T03:39:44.437611Z",
            "url": "https://files.pythonhosted.org/packages/c2/ad/ff311ecded3a1bfeaa6ff6d31eaea30eeafd3334a3828a4fcae136beb7bb/python_memes-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-28 03:39:44",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "python-memes"
}
        
Elapsed time: 1.94292s