poethu


Namepoethu JSON
Version 1.0.4 PyPI version JSON
download
home_pagehttps://github.com/bxn4/poethu
SummaryAn unofficial Python wrapper for the poet.hu API
upload_time2023-09-02 22:42:44
maintainer
docs_urlNone
authorBXn4 (Bence)
requires_python>=3.0
licenseMIT
keywords python poet api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # poethu

poethu is a simple Python library that makes easy to access data from [poet.hu](https://www.poet.hu)

To access the API first you need to [register](https://www.poet.hu/regisztracio.php) on the site.

### Installation (pypi)
```bash
pip install poethu
```
### How to install?
First you need to install Python, if it is not installed it will won't work.

[Download Python](https://www.python.org/downloads/)

```bash
# Ubuntu / Debian
$ sudo apt install python

# Fedora
$ sudo dnf install python
```

Download required packages:
```bash
$ pip install requests
```

### How to use?
Using poethu is very easy.
First you need to register to the site to get the key.
You can do it [here](https://www.poet.hu/regisztracio.php).
After you succesfully registered you can get your key [here](https://poet.hu/api.php)

![image](https://github.com/BXn4/poethu/assets/78733248/2dfdc088-2be4-42f8-82db-f27c2072e32a)

### Usage:
Note: the synonyms and poems returns as a list If you want more than 1 synonyms or poems.
```python
import poethu

poet = poethu.API(username="your_username", password="your_key")
```

#### To get synonyms:
```python
synonyms = poet.get_szinonima(word="Helló") # Change the word to anything else to get the word synonym
print(synonyms)
```
You can easily change the order, or change the max synonym:
```python
synonyms = poet.get_szinonima(word="Helló", order="desc", max=10) # order by desc, and max 10 synonym
print(synonyms)
```

#### And for poems:
```python
poems = poet.get_versek(category="kedvesemnek", max=2)
# The output is raw, so we need to format it.

# You only need to use loops when you want to get more poems than 1
# If you not, you can simply use title = poet.get_title(poems)

for i in range(len(poems)):
    title = poet.get_title(poems)[i]
    text = poet.get_text(poems)[i]
    poem = poet.get_text(poems)[i]
    author = poet.get_author(poems)[i]
    category = poet.get_category(poems)[i]
    favs = poet.get_favs(poems)[i]
    id = poet.get_id(poems)[i]
    url = poet.get_url(poems)[i]

    print(f"Title: {title}")
    print(f"Text: {text}")
    print(f"Author: {author}")
    print(f"Category: {category}")
    print(f"Favs: {favs}")
    print(f"ID: {id}")
    print(f"url: {url}")
```
Poem params:
```
category
author
text
max (number)
order_by (id, ido, szerzo, kedvencek, veletlen)
order (asc, desc)
continue_from (number)
```
You can get more information about the API [here](https://www.poet.hu/api.php)

#### Example usage:
Synonyms:
```python
import poethu

poet = poethu.API(username="your_username", password="your_key")

synonyms = poet.get_szinonima(word="Helló", order="asc", max=5)

for i in range(len(synonyms)):
    synonym = synonyms[i]
    print(f"{i}: {synonym}")
```
Output:
```
0: üdv
1: szia
2: cső
3: szervusz
4: hahó
```
Poems:
```python
import poethu

poet = poethu.API(username="your_username", password="your_key")

poems = poet.get_versek(category="gyerekvers", max=2, order="desc", continue_from=20)
# The output is raw, so we need to format it.

# You only need to use loops when you want to get more poems than 1
# If you not, you can simply use title = poet.get_title(poems)

for i in range(len(poems)):
    title = poet.get_title(poems)[i]
    text = poet.get_text(poems)[i]
    poem = poet.get_text(poems)[i]
    author = poet.get_author(poems)[i]
    category = poet.get_category(poems)[i]
    favs = poet.get_favs(poems)[i]
    id = poet.get_id(poems)[i]
    url = poet.get_url(poems)[i]

    print(f"Title: {title}")
    print(f"Poem text: \n{text}")
    print(f"Author: {author}")
    print(f"Category: {category}")
    print(f"Favs: {favs}")
    print(f"ID: {id}")
    print(f"URL: {url}")
```
Output:
```
Title: Farkas és a bárány
Poem text:
Én vagyok a farkas,
Fél tőlem a szarvas,
Ha prédára akadok,
Az erdőben maradok.

Az én nevem barika,
Barátom a Gabika,
Jaj, de félve lépkedek,
Ha erdőbe tévedek.
Author: Tóth Marianna (banattanc)
Category: Gyerekvers
Favs: 23
ID: 351818
URL: https://www.poet.hu/vers/351818
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bxn4/poethu",
    "name": "poethu",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.0",
    "maintainer_email": "",
    "keywords": "python poet API",
    "author": "BXn4 (Bence)",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/4d/cb/a29f45291965b1b835f9e4120de717ac3d44dfa655c981e4d0d2810cafc8/poethu-1.0.4.tar.gz",
    "platform": null,
    "description": "# poethu\n\npoethu is a simple Python library that makes easy to access data from [poet.hu](https://www.poet.hu)\n\nTo access the API first you need to [register](https://www.poet.hu/regisztracio.php) on the site.\n\n### Installation (pypi)\n```bash\npip install poethu\n```\n### How to install?\nFirst you need to install Python, if it is not installed it will won't work.\n\n[Download Python](https://www.python.org/downloads/)\n\n```bash\n# Ubuntu / Debian\n$ sudo apt install python\n\n# Fedora\n$ sudo dnf install python\n```\n\nDownload required packages:\n```bash\n$ pip install requests\n```\n\n### How to use?\nUsing poethu is very easy.\nFirst you need to register to the site to get the key.\nYou can do it [here](https://www.poet.hu/regisztracio.php).\nAfter you succesfully registered you can get your key [here](https://poet.hu/api.php)\n\n![image](https://github.com/BXn4/poethu/assets/78733248/2dfdc088-2be4-42f8-82db-f27c2072e32a)\n\n### Usage:\nNote: the synonyms and poems returns as a list If you want more than 1 synonyms or poems.\n```python\nimport poethu\n\npoet = poethu.API(username=\"your_username\", password=\"your_key\")\n```\n\n#### To get synonyms:\n```python\nsynonyms = poet.get_szinonima(word=\"Hell\u00f3\") # Change the word to anything else to get the word synonym\nprint(synonyms)\n```\nYou can easily change the order, or change the max synonym:\n```python\nsynonyms = poet.get_szinonima(word=\"Hell\u00f3\", order=\"desc\", max=10) # order by desc, and max 10 synonym\nprint(synonyms)\n```\n\n#### And for poems:\n```python\npoems = poet.get_versek(category=\"kedvesemnek\", max=2)\n# The output is raw, so we need to format it.\n\n# You only need to use loops when you want to get more poems than 1\n# If you not, you can simply use title = poet.get_title(poems)\n\nfor i in range(len(poems)):\n    title = poet.get_title(poems)[i]\n    text = poet.get_text(poems)[i]\n    poem = poet.get_text(poems)[i]\n    author = poet.get_author(poems)[i]\n    category = poet.get_category(poems)[i]\n    favs = poet.get_favs(poems)[i]\n    id = poet.get_id(poems)[i]\n    url = poet.get_url(poems)[i]\n\n    print(f\"Title: {title}\")\n    print(f\"Text: {text}\")\n    print(f\"Author: {author}\")\n    print(f\"Category: {category}\")\n    print(f\"Favs: {favs}\")\n    print(f\"ID: {id}\")\n    print(f\"url: {url}\")\n```\nPoem params:\n```\ncategory\nauthor\ntext\nmax (number)\norder_by (id, ido, szerzo, kedvencek, veletlen)\norder (asc, desc)\ncontinue_from (number)\n```\nYou can get more information about the API [here](https://www.poet.hu/api.php)\n\n#### Example usage:\nSynonyms:\n```python\nimport poethu\n\npoet = poethu.API(username=\"your_username\", password=\"your_key\")\n\nsynonyms = poet.get_szinonima(word=\"Hell\u00f3\", order=\"asc\", max=5)\n\nfor i in range(len(synonyms)):\n    synonym = synonyms[i]\n    print(f\"{i}: {synonym}\")\n```\nOutput:\n```\n0: \u00fcdv\n1: szia\n2: cs\u0151\n3: szervusz\n4: hah\u00f3\n```\nPoems:\n```python\nimport poethu\n\npoet = poethu.API(username=\"your_username\", password=\"your_key\")\n\npoems = poet.get_versek(category=\"gyerekvers\", max=2, order=\"desc\", continue_from=20)\n# The output is raw, so we need to format it.\n\n# You only need to use loops when you want to get more poems than 1\n# If you not, you can simply use title = poet.get_title(poems)\n\nfor i in range(len(poems)):\n    title = poet.get_title(poems)[i]\n    text = poet.get_text(poems)[i]\n    poem = poet.get_text(poems)[i]\n    author = poet.get_author(poems)[i]\n    category = poet.get_category(poems)[i]\n    favs = poet.get_favs(poems)[i]\n    id = poet.get_id(poems)[i]\n    url = poet.get_url(poems)[i]\n\n    print(f\"Title: {title}\")\n    print(f\"Poem text: \\n{text}\")\n    print(f\"Author: {author}\")\n    print(f\"Category: {category}\")\n    print(f\"Favs: {favs}\")\n    print(f\"ID: {id}\")\n    print(f\"URL: {url}\")\n```\nOutput:\n```\nTitle: Farkas \u00e9s a b\u00e1r\u00e1ny\nPoem text:\n\u00c9n vagyok a farkas,\nF\u00e9l t\u0151lem a szarvas,\nHa pr\u00e9d\u00e1ra akadok,\nAz erd\u0151ben maradok.\n\nAz \u00e9n nevem barika,\nBar\u00e1tom a Gabika,\nJaj, de f\u00e9lve l\u00e9pkedek,\nHa erd\u0151be t\u00e9vedek.\nAuthor: T\u00f3th Marianna (banattanc)\nCategory: Gyerekvers\nFavs: 23\nID: 351818\nURL: https://www.poet.hu/vers/351818\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An unofficial Python wrapper for the poet.hu API",
    "version": "1.0.4",
    "project_urls": {
        "Homepage": "https://github.com/bxn4/poethu"
    },
    "split_keywords": [
        "python",
        "poet",
        "api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a97645d5dc2721cf58537c8fe6a118961dac335894331e3485593fe2e70f329f",
                "md5": "615e853378f63d7e7a541262a283233f",
                "sha256": "8e0384257cbcf05877c2d3e51d3290953149e0d693bbe7e3a3172e433d5d1437"
            },
            "downloads": -1,
            "filename": "poethu-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "615e853378f63d7e7a541262a283233f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.0",
            "size": 4178,
            "upload_time": "2023-09-02T22:42:42",
            "upload_time_iso_8601": "2023-09-02T22:42:42.632380Z",
            "url": "https://files.pythonhosted.org/packages/a9/76/45d5dc2721cf58537c8fe6a118961dac335894331e3485593fe2e70f329f/poethu-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4dcba29f45291965b1b835f9e4120de717ac3d44dfa655c981e4d0d2810cafc8",
                "md5": "7e2a7be57a46b1f5a7d5295206bb0a68",
                "sha256": "35981ce7a45990d33f4da0b7866c46bd9faf6d1b1a13861a3f22f959092e2182"
            },
            "downloads": -1,
            "filename": "poethu-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "7e2a7be57a46b1f5a7d5295206bb0a68",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.0",
            "size": 4188,
            "upload_time": "2023-09-02T22:42:44",
            "upload_time_iso_8601": "2023-09-02T22:42:44.170806Z",
            "url": "https://files.pythonhosted.org/packages/4d/cb/a29f45291965b1b835f9e4120de717ac3d44dfa655c981e4d0d2810cafc8/poethu-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-02 22:42:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bxn4",
    "github_project": "poethu",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "poethu"
}
        
Elapsed time: 0.10949s