enkanetworkcard


Nameenkanetworkcard JSON
Version 0.3.1 PyPI version JSON
download
home_pagehttps://github.com/DEViantUA/EnkaNetworkCard/wiki/Dokumentation-enkanetworkcard
SummaryWrapper module for enkanetwork.py for creating character cards.
upload_time2022-12-31 17:32:32
maintainer
docs_urlNone
authorNone
requires_python>=3.6,<4.0
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
  <img src="https://raw.githubusercontent.com/DEViantUA/EnkaNetworkCard/main/img/banner.jpg" alt="Баннер"/>
</p>

**<p align="center"> <a href="https://github.com/DEViantUA/EnkaNetworkCard/wiki/EnkaNetworkCard-RU">Русская версия</a> | <a href="https://github.com/DEViantUA/EnkaNetworkCard/tree/main/Example">Example</a> | <a href = "https://discord.gg/SJ3d9x4e"> Discord <a> </p>**

# EnkaNetworkCard
Wrapper for [EnkaNetwork.py](https://github.com/mrwan200/EnkaNetwork.py) to create character cards in Python.

## Full Documentation:

En: [Documentation EN](https://deviantua.github.io/EnkaNetworkCard-Documentation/) 

## Navigation
* Installation
* Dependencies
* Launch
* Running Async
* Fix bug with async
* Get a character showcase
* Description of arguments
* Languages Supported
* Sample Results

## Installation:

```
pip install enkanetworkcard
```
Or you can copy the given repository.

### Dependencies:
  Dependencies that must be installed for the library to work:
  * Pillow
  * requests
  * io
  * math
  * threading
  * datetime
  * random
  * enkanetwork
  * logging

## Launch:
``` python
from enkanetworkcard import encbanner

ENC = encbanner.EnkaGenshinGeneration() 

result = ENC.start(uids = 724281429)

print(result)

```
## Running Async:

``` python
from enkanetworkcard import aioenkbanner
import asyncio

async def card():
    ENC = aioenkbanner.EnkaGenshinGeneration()
    return await ENC.start(uids = 724281429)

result = asyncio.run(card()) 

print(result)
```
_Thank you for this example and advice: [Gaurav Mandal](https://github.com/GauravM512)_

## Fix bug with async:
Windows users may experience an error: ```RuntimeError: Event loop is closed``` if this occurs, then you must set the variable ```FIX_ASYNCIO_WIN = True```

### Example
``` python 
from enkanetworkcard import encbanner

ENC = encbanner.EnkaGenshinGeneration() 
ENC.FIX_ASYNCIO_WIN = True
```

## Get a character showcase:
```profile``` - A useful feature for bot developers. Get information about the characters from the showcase, for their further use.

### Example
``` python
from enkanetworkcard import encbanner

ENC = encbanner.EnkaGenshinGeneration()
resultProfile = ENC.profile(uid = 724281429, image = False)
result = ENC.start(uids = 724281429, name = resultProfile["charactersArg"])

print(result)
```
Function: ```profile``` returns: ```characters```, ```charactersArg```, ```img```
- ```characters``` - Information about each character.
- ```charactersArg``` - List of character names to quickly pass to ```start()```
- ```img``` - Showcase generated image.


## Description of arguments:
Main class: <code>EnkaGenshinGeneration</code> Contains the following arguments <code>lang</code>,<code>img</code>,<code>charterImg</code>,<code>name</code>,<code>adapt</code>,<code>randomImg</code>,<code>hide</code>,<code>dowload</code>,<code>namecard</code>,<code>splash</code>

### Class argument description::
* <code>lang</code> - Takes one value to define the language. Supported languages are listed below in the documentation. The default is Russian.
* Values: str
* Example str: ```EnkaGenshinGeneration(lang = "en")```
-----
* <code>img</code> - If you want to use your image on the card, then pass this argument.
* Values str: Image link or the path to the file.
* Values PIL.ImageFile: Image opened with Image.open()
* Values list: Image link, the path to the file or PIL.ImageFile
* Example str the path to the file: ```EnkaGenshinGeneration(img = "img.png")```
* Example str image link: ```EnkaGenshinGeneration(img = "https//...image.png")```
* Example PIL.ImageFile: ```EnkaGenshinGeneration(img = Image.open("img.png"))```
* Example list: ```EnkaGenshinGeneration(img = [Image.open("img.png"), "img.png", "https//...image.png"])``` - list only works with the argument: ```randomImg```.
-----
* <code>charterImg</code> - Give each character a custom image.
* Values dict: Can take all values from the img argument except list.
* Example dict: ```EnkaGenshinGeneration(charterImg = {"Klee": Image.open("img.png"), "Albedo": "img.png", "Xiao": "https//...image.png"})```
-----
* <code>name</code> - Needed if you want to get certain characters.
* Values: str
* Example str one character: ```EnkaGenshinGeneration(name = "Klee")```
* Example str two or more characters: ```EnkaGenshinGeneration(name = "Klee, Albedo, ...")```
-----
* <code>adapt</code> - Adapt background to custom image.
* Values: bool
* Example bool: ```EnkaGenshinGeneration(img = "img.png", adapt = True)```
-----
* <code>randomImg</code> - Random selection of custom images from the list.
* Values: bool
* Example bool: ```EnkaGenshinGeneration(img = [Image.open("img.png"), "img.png"], randomImg = True)``` - If img is not a list, then randomImg is ignored.
-----
* <code>hide</code> - Hide the UID on the character card.
* Values: bool
* Example bool: ```EnkaGenshinGeneration(hide = True)```
-----
* <code>dowload</code> - Will return ready images for further work with them. (If not specified, then the finished results will be saved in the directory of the executable file in the folder and return None: ```EnkaImg```)
* Values: bool
* Example bool: ```EnkaGenshinGeneration(dowload = True)```
-----
* ```namecard``` - Replaces the background of the player card image with character images. (Used only for the second template.)
* Values: bool
* Example bool: ```EnkaGenshinGeneration(namecard = True)```
-----
* <code>splash</code> - Displays splashes of characters in costumes
* Values: bool
* Example bool: ```EnkaGenshinGeneration(splash= True)```
-----

The main function of the class: <code>start</code> takes ```template```, ```uids```, ```name```  argument
### Function argument description::
* ```uids``` - Game UID in the game Genshin Impact.
* Values: int, str
* Example int: ```EnkaGenshinGeneration().start(uids = 757562748)```
* Example str one UID: ```EnkaGenshinGeneration().start(uids = "757562748")```
* Example str two or more UID: ```EnkaGenshinGeneration().start(uids = "757562748,544523587,874385763")```
-----
* ```template``` - Changes the character card template.
* Values: int
* Example int: ```EnkaGenshinGeneration().start(uids = "757562748", template = 2)```
-----
* <code>name</code> - Needed if you want to get certain characters.
* Values: str
* Example str one character: ```EnkaGenshinGeneration(uids = "757562748", name = "Klee")```
* Example str two or more characters: ```EnkaGenshinGeneration.start(uids = "757562748", name = "Klee, Albedo, ...")```
-----

Additional class function: <code>profile</code> takes ```uid```, ```image```  argument
* ```uid``` - Game UID in the game Genshin Impact.
* Values: int
* Example int: ```EnkaGenshinGeneration().profile(uids = 757562748)```
-----
* ```image``` - Generate a showcase image. (Default True)
* Values: bool
* Example bool: ```EnkaGenshinGeneration().profile(uid = 757562748б, image = False)```


## Languages Supported
| Languege    |  Code   | Languege    |  Code   |
|-------------|---------|-------------|---------|
|  English    |     en  |  русский    |     ru  |
|  Tiếng Việt |     vi  |  ไทย        |     th  |
|  português  |     pt  | 한국어      |     kr  |
|  日本語      |     jp  | 中文        |     zh  |
|  中文        |     zh  | Indonesian |     id  |
|  français   |     fr  | español    |     es  |
|  deutsch    |     de  | Taiwan     |    cht  |
|  Chinese    |    chs  |      |      |

## Sample Results:


### The result of a custom images and adaptation (template= 1).
<img src="https://raw.githubusercontent.com/DEViantUA/EnkaNetworkCard/main/img/Example1.png" width='300' alt="Example1"/> <img src="https://raw.githubusercontent.com/DEViantUA/EnkaNetworkCard/main/img/Example2.png" width='300' alt="Example2"/> 

### Usual result (template= 1).
<img src="https://raw.githubusercontent.com/DEViantUA/EnkaNetworkCard/main/img/Example3.png" width='300' alt="Example3"/> <img src="https://raw.githubusercontent.com/DEViantUA/EnkaNetworkCard/main/img/Example4.png" width='300' alt="Example4"/> 

### The result of a custom images and adaptation (template= 2).
<img src="https://raw.githubusercontent.com/DEViantUA/EnkaNetworkCard/main/img/Example5.png.png" width='300' alt="namecard = True"/> <img src="https://raw.githubusercontent.com/DEViantUA/EnkaNetworkCard/main/img/Example6.png.png" width='300' alt="namecard = False"/> 

### Usual result (template= 2).
<img src="https://raw.githubusercontent.com/DEViantUA/EnkaNetworkCard/main/img/Example8.png.png" width='300' alt="namecard = True"/> <img src="https://raw.githubusercontent.com/DEViantUA/EnkaNetworkCard/main/img/Example7.png.png" width='300' alt="namecard = False"/> 
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/DEViantUA/EnkaNetworkCard/wiki/Dokumentation-enkanetworkcard",
    "name": "enkanetworkcard",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "None",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/af/a0/233769790dc0c084d6614f4c7e817d6f58f05bc0e0bc1cd4eb819ea1eb5e/enkanetworkcard-0.3.1.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/DEViantUA/EnkaNetworkCard/main/img/banner.jpg\" alt=\"\u0411\u0430\u043d\u043d\u0435\u0440\"/>\n</p>\n\n**<p align=\"center\"> <a href=\"https://github.com/DEViantUA/EnkaNetworkCard/wiki/EnkaNetworkCard-RU\">\u0420\u0443\u0441\u0441\u043a\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f</a> | <a href=\"https://github.com/DEViantUA/EnkaNetworkCard/tree/main/Example\">Example</a> | <a href = \"https://discord.gg/SJ3d9x4e\"> Discord <a> </p>**\n\n# EnkaNetworkCard\nWrapper for [EnkaNetwork.py](https://github.com/mrwan200/EnkaNetwork.py) to create character cards in Python.\n\n## Full Documentation:\n\nEn: [Documentation EN](https://deviantua.github.io/EnkaNetworkCard-Documentation/) \n\n## Navigation\n* Installation\n* Dependencies\n* Launch\n* Running Async\n* Fix bug with async\n* Get a character showcase\n* Description of arguments\n* Languages Supported\n* Sample Results\n\n## Installation:\n\n```\npip install enkanetworkcard\n```\nOr you can copy the given repository.\n\n### Dependencies:\n  Dependencies that must be installed for the library to work:\n  * Pillow\n  * requests\n  * io\n  * math\n  * threading\n  * datetime\n  * random\n  * enkanetwork\n  * logging\n\n## Launch:\n``` python\nfrom enkanetworkcard import encbanner\n\nENC = encbanner.EnkaGenshinGeneration() \n\nresult = ENC.start(uids = 724281429)\n\nprint(result)\n\n```\n## Running Async:\n\n``` python\nfrom enkanetworkcard import aioenkbanner\nimport asyncio\n\nasync def card():\n    ENC = aioenkbanner.EnkaGenshinGeneration()\n    return await ENC.start(uids = 724281429)\n\nresult = asyncio.run(card()) \n\nprint(result)\n```\n_Thank you for this example and advice: [Gaurav Mandal](https://github.com/GauravM512)_\n\n## Fix bug with async:\nWindows users may experience an error: ```RuntimeError: Event loop is closed``` if this occurs, then you must set the variable ```FIX_ASYNCIO_WIN = True```\n\n### Example\n``` python \nfrom enkanetworkcard import encbanner\n\nENC = encbanner.EnkaGenshinGeneration() \nENC.FIX_ASYNCIO_WIN = True\n```\n\n## Get a character showcase:\n```profile``` - A useful feature for bot developers. Get information about the characters from the showcase, for their further use.\n\n### Example\n``` python\nfrom enkanetworkcard import encbanner\n\nENC = encbanner.EnkaGenshinGeneration()\nresultProfile = ENC.profile(uid = 724281429, image = False)\nresult = ENC.start(uids = 724281429, name = resultProfile[\"charactersArg\"])\n\nprint(result)\n```\nFunction: ```profile``` returns: ```characters```, ```charactersArg```, ```img```\n- ```characters``` - Information about each character.\n- ```charactersArg``` - List of character names to quickly pass to ```start()```\n- ```img``` - Showcase generated image.\n\n\n## Description of arguments:\nMain class: <code>EnkaGenshinGeneration</code> Contains the following arguments <code>lang</code>,<code>img</code>,<code>charterImg</code>,<code>name</code>,<code>adapt</code>,<code>randomImg</code>,<code>hide</code>,<code>dowload</code>,<code>namecard</code>,<code>splash</code>\n\n### Class argument description::\n* <code>lang</code> - Takes one value to define the language. Supported languages are listed below in the documentation. The default is Russian.\n* Values: str\n* Example str: ```EnkaGenshinGeneration(lang = \"en\")```\n-----\n* <code>img</code> - If you want to use your image on the card, then pass this argument.\n* Values str: Image link or the path to the file.\n* Values PIL.ImageFile: Image opened with Image.open()\n* Values list: Image link, the path to the file or PIL.ImageFile\n* Example str the path to the file: ```EnkaGenshinGeneration(img = \"img.png\")```\n* Example str image link: ```EnkaGenshinGeneration(img = \"https//...image.png\")```\n* Example PIL.ImageFile: ```EnkaGenshinGeneration(img = Image.open(\"img.png\"))```\n* Example list: ```EnkaGenshinGeneration(img = [Image.open(\"img.png\"), \"img.png\", \"https//...image.png\"])``` - list only works with the argument: ```randomImg```.\n-----\n* <code>charterImg</code> - Give each character a custom image.\n* Values dict: Can take all values from the img argument except list.\n* Example dict: ```EnkaGenshinGeneration(charterImg = {\"Klee\": Image.open(\"img.png\"), \"Albedo\": \"img.png\", \"Xiao\": \"https//...image.png\"})```\n-----\n* <code>name</code> - Needed if you want to get certain characters.\n* Values: str\n* Example str one character: ```EnkaGenshinGeneration(name = \"Klee\")```\n* Example str two or more characters: ```EnkaGenshinGeneration(name = \"Klee, Albedo, ...\")```\n-----\n* <code>adapt</code> - Adapt background to custom image.\n* Values: bool\n* Example bool: ```EnkaGenshinGeneration(img = \"img.png\", adapt = True)```\n-----\n* <code>randomImg</code> - Random selection of custom images from the list.\n* Values: bool\n* Example bool: ```EnkaGenshinGeneration(img = [Image.open(\"img.png\"), \"img.png\"], randomImg = True)``` - If img is not a list, then randomImg is ignored.\n-----\n* <code>hide</code> - Hide the UID on the character card.\n* Values: bool\n* Example bool: ```EnkaGenshinGeneration(hide = True)```\n-----\n* <code>dowload</code> - Will return ready images for further work with them. (If not specified, then the finished results will be saved in the directory of the executable file in the folder and return None: ```EnkaImg```)\n* Values: bool\n* Example bool: ```EnkaGenshinGeneration(dowload = True)```\n-----\n* ```namecard``` - Replaces the background of the player card image with character images. (Used only for the second template.)\n* Values: bool\n* Example bool: ```EnkaGenshinGeneration(namecard = True)```\n-----\n* <code>splash</code> - Displays splashes of characters in costumes\n* Values: bool\n* Example bool: ```EnkaGenshinGeneration(splash= True)```\n-----\n\nThe main function of the class: <code>start</code> takes ```template```, ```uids```, ```name```  argument\n### Function argument description::\n* ```uids``` - Game UID in the game Genshin Impact.\n* Values: int, str\n* Example int: ```EnkaGenshinGeneration().start(uids = 757562748)```\n* Example str one UID: ```EnkaGenshinGeneration().start(uids = \"757562748\")```\n* Example str two or more UID: ```EnkaGenshinGeneration().start(uids = \"757562748,544523587,874385763\")```\n-----\n* ```template``` - Changes the character card template.\n* Values: int\n* Example int: ```EnkaGenshinGeneration().start(uids = \"757562748\", template = 2)```\n-----\n* <code>name</code> - Needed if you want to get certain characters.\n* Values: str\n* Example str one character: ```EnkaGenshinGeneration(uids = \"757562748\", name = \"Klee\")```\n* Example str two or more characters: ```EnkaGenshinGeneration.start(uids = \"757562748\", name = \"Klee, Albedo, ...\")```\n-----\n\nAdditional class function: <code>profile</code> takes ```uid```, ```image```  argument\n* ```uid``` - Game UID in the game Genshin Impact.\n* Values: int\n* Example int: ```EnkaGenshinGeneration().profile(uids = 757562748)```\n-----\n* ```image``` - Generate a showcase image. (Default True)\n* Values: bool\n* Example bool: ```EnkaGenshinGeneration().profile(uid = 757562748\u0431, image = False)```\n\n\n## Languages Supported\n| Languege    |  Code   | Languege    |  Code   |\n|-------------|---------|-------------|---------|\n|  English    |     en  |  \u0440\u0443\u0441\u0441\u043a\u0438\u0439    |     ru  |\n|  Ti\u1ebfng Vi\u1ec7t |     vi  |  \u0e44\u0e17\u0e22        |     th  |\n|  portugu\u00eas  |     pt  | \ud55c\uad6d\uc5b4      |     kr  |\n|  \u65e5\u672c\u8a9e      |     jp  | \u4e2d\u6587        |     zh  |\n|  \u4e2d\u6587        |     zh  | Indonesian |     id  |\n|  fran\u00e7ais   |     fr  | espa\u00f1ol    |     es  |\n|  deutsch    |     de  | Taiwan     |    cht  |\n|  Chinese    |    chs  |      |      |\n\n## Sample Results:\n\n\n### The result of a custom images and adaptation (template= 1).\n<img src=\"https://raw.githubusercontent.com/DEViantUA/EnkaNetworkCard/main/img/Example1.png\" width='300' alt=\"Example1\"/> <img src=\"https://raw.githubusercontent.com/DEViantUA/EnkaNetworkCard/main/img/Example2.png\" width='300' alt=\"Example2\"/> \n\n### Usual result (template= 1).\n<img src=\"https://raw.githubusercontent.com/DEViantUA/EnkaNetworkCard/main/img/Example3.png\" width='300' alt=\"Example3\"/> <img src=\"https://raw.githubusercontent.com/DEViantUA/EnkaNetworkCard/main/img/Example4.png\" width='300' alt=\"Example4\"/> \n\n### The result of a custom images and adaptation (template= 2).\n<img src=\"https://raw.githubusercontent.com/DEViantUA/EnkaNetworkCard/main/img/Example5.png.png\" width='300' alt=\"namecard = True\"/> <img src=\"https://raw.githubusercontent.com/DEViantUA/EnkaNetworkCard/main/img/Example6.png.png\" width='300' alt=\"namecard = False\"/> \n\n### Usual result (template= 2).\n<img src=\"https://raw.githubusercontent.com/DEViantUA/EnkaNetworkCard/main/img/Example8.png.png\" width='300' alt=\"namecard = True\"/> <img src=\"https://raw.githubusercontent.com/DEViantUA/EnkaNetworkCard/main/img/Example7.png.png\" width='300' alt=\"namecard = False\"/> ",
    "bugtrack_url": null,
    "license": "",
    "summary": "Wrapper module for enkanetwork.py for creating character cards.",
    "version": "0.3.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "bdcffdf5f89ef644889bc1171d42b941",
                "sha256": "58cba0051f3e1dd6918c3c5ae4e2f99f91d1e42499ab710ca19e5e248051e8dc"
            },
            "downloads": -1,
            "filename": "enkanetworkcard-0.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bdcffdf5f89ef644889bc1171d42b941",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6,<4.0",
            "size": 32648069,
            "upload_time": "2022-12-31T17:31:28",
            "upload_time_iso_8601": "2022-12-31T17:31:28.439948Z",
            "url": "https://files.pythonhosted.org/packages/82/58/a8eddd2a5066738d5a048fcbed3b890fd0206ddcf4f896964de7bc85c64f/enkanetworkcard-0.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "64e8cdbb906dba06eb6f4c6fddc71c6e",
                "sha256": "ed32e70c5346faf8f885309db07619076b068f92a8f36677038262fce5881d37"
            },
            "downloads": -1,
            "filename": "enkanetworkcard-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "64e8cdbb906dba06eb6f4c6fddc71c6e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6,<4.0",
            "size": 32552789,
            "upload_time": "2022-12-31T17:32:32",
            "upload_time_iso_8601": "2022-12-31T17:32:32.730470Z",
            "url": "https://files.pythonhosted.org/packages/af/a0/233769790dc0c084d6614f4c7e817d6f58f05bc0e0bc1cd4eb819ea1eb5e/enkanetworkcard-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-31 17:32:32",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "enkanetworkcard"
}
        
Elapsed time: 0.03593s