mymemopy


Namemymemopy JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/kurotom/MyMemoPy
SummaryTranslate phrases or texts using the Mymemory API in a simple way.
upload_time2023-12-14 14:35:52
maintainer
docs_urlNone
authorkurotom
requires_python>=3.7,<4.0
licenseGPL-3.0-or-later
keywords translator translation api mymemory api simple
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Mymemopy

Allows you to translate phrases or text using [Mymemory API](https://mymemory.translated.net/).

# Usage

Just import the `MyMemoryTranslate` class and use the `translate` method, provide the `text`, `source_lang` and `target_lang` parameters, wait for the API response and get your translation.

The API accepts two types of users: `Valid User` (who uses a validated email or API key) and `Anonymous User` (who does not have an email or key). Both have character limitations per day for each translation. [See more details](#API-usage-limits).


## Example of use

```python
>>> from mymemopy.translator import MyMemoryTranslate
>>>
>>> def valid_user():
...     vu = MyMemoryTranslate(user_email='example@example.com')
...     print(vu)
...     print(vu.get_quota())
...     res = vu.translate(text='hola', source_lang='es', target_lang='en')
...     print(res)
...     print(vu)
...
>>>
>>> def anon_user():
...     au = MyMemoryTranslate()
...     print(au)
...     print(au.get_quota())
...     res = au.translate(text='hola', source_lang='es', target_lang='en')
...     print(res)
...     print(au)
...
>>>
>>>
>>> valid_user()
User: UserValid, Usage: 20, Limit: 50000, Email: example@example.com
20
hello.
User: UserValid, Usage: 24, Limit: 50000, Email: example@example.com
>>>
>>> anon_user()
User: Anonymous, Usage: 4, Limit: 5000, Email: None
4
hello.
User: Anonymous, Usage: 8, Limit: 5000, Email: None
>>>
```




# MyMemory: API technical specifications

## Get

Searches MyMemory for matches against a segment.

Call example:

<a href='https://api.mymemory.translated.net/get?q=Hello World!&langpair=en|it'>https://api.mymemory.translated.net/get?q=Hello World!&langpair=en|it</a>


|     |     |     |     |
| --- | --- | --- | --- |
| \*\*Parameter\*\* | \*\*Description\*\* | \*\*Type\*\* | \*\*Example value\*\* |
| q   | The sentence you want to translate. Use UTF-8. \*\*Max 500 bytes\*\* | Mandatory | Hello World! |
| langpair | Source and language pair, separated by the \| symbol. Use ISO standard names or RFC3066 | Mandatory | en\|it |
| mt  | Enables Machine Translation in results. You can turn it off if you want just human segments | Optional | 1 (default), 0 |
| key | Authenticates the request; matches from your private TM are returned too. \*\*Get your key \[here\](keygen.php) or use the keygen API\*\* | Optional |     |
| onlyprivate | If your request is authenticated, returns only matches from your private TM | Optional | 0 (default), 1 |
| ip  | The IP of the end user generating the request. \*\*Recommended for CAT tools and high volume usage\*\* Originating IP is always overridden by \_X-Forwarded-For\_ header, if the latter is set | Optional | 93.81.217.71 |
| de  | A valid email where we can reach you in case of troubles. \*\*Recommended for CAT tools and high volume usage\*\* | Optional | user@yourdomain.com |
| user | Authenticates the request; matches from your private TM are returned too | Optional, but needs the key parameter. Kept for backward compatibility only: now the \*\*key\*\* parameter alone is sufficient |     |

## Keygen

Generates the key associated with a username.

Call example:

<a href='https://api.mymemory.translated.net/keygen?user=username&pass=password'>https://api.mymemory.translated.net/keygen?user=username&pass=password</a>



Parameter description:

|     |     |     |     |
| --- | --- | --- | --- |
| **Parameter** | **Description** | **Type** | **Example value** |
| user | The username whose key we want to generate | Mandatory |     |
| pass | The password associated with the username | Mandatory |     |


<a name="API-usage-limits"></a>

# API usage limits

## Get

Searches MyMemory for matches against a segment.

MyMemory tracks it usage in words. This means that it doesn't matter how many requests you submit to consult the archive, but the weight of each request.

> **Free, anonymous usage is limited to <u>5000 chars/day</u>.**

> **Provide a valid email ('de' parameter), where we can reach you in case of troubles, and enjoy <u>50000 chars/day</u>.**

Are you a CAT tool maker? Get whitelisted! Write us and get 150000 chars/day!*

If you are interested in even larger volumes, have a look at our RapidAPI plans!

Don't forget to check out carefully our Terms of Service, also.

* Note for developers:
Please bear in mind that we are eager to include in whitelisting program only estabilished projects of interest (have a look at "Most popular CAT tools" under CAT section, to get an idea of required market share).
Personal projects or "in development" stuff, projects that just use the "get" endpoint without contributing to MyMemory using the "set" endpoint, never qualify for the whitelisting.
Requests failing in complying with such minimum directive will be disregarded.


## Keygen

Generates the key associated with a username.

To prevent abuse, we keep track of call rate and enforce limits when necessary.


## Set

Contributes a translation unit (segment and translation) in some language pair to MyMemory.

This is never limited.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/kurotom/MyMemoPy",
    "name": "mymemopy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<4.0",
    "maintainer_email": "",
    "keywords": "translator,translation,api,Mymemory API,simple",
    "author": "kurotom",
    "author_email": "55354389+kurotom@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/50/48/5070742c5c5c747184f1cd1bf550828b10d2ee0803e98ff614812b3c2245/mymemopy-0.1.1.tar.gz",
    "platform": null,
    "description": "# Mymemopy\n\nAllows you to translate phrases or text using [Mymemory API](https://mymemory.translated.net/).\n\n# Usage\n\nJust import the `MyMemoryTranslate` class and use the `translate` method, provide the `text`, `source_lang` and `target_lang` parameters, wait for the API response and get your translation.\n\nThe API accepts two types of users: `Valid User` (who uses a validated email or API key) and `Anonymous User` (who does not have an email or key). Both have character limitations per day for each translation. [See more details](#API-usage-limits).\n\n\n## Example of use\n\n```python\n>>> from mymemopy.translator import MyMemoryTranslate\n>>>\n>>> def valid_user():\n...     vu = MyMemoryTranslate(user_email='example@example.com')\n...     print(vu)\n...     print(vu.get_quota())\n...     res = vu.translate(text='hola', source_lang='es', target_lang='en')\n...     print(res)\n...     print(vu)\n...\n>>>\n>>> def anon_user():\n...     au = MyMemoryTranslate()\n...     print(au)\n...     print(au.get_quota())\n...     res = au.translate(text='hola', source_lang='es', target_lang='en')\n...     print(res)\n...     print(au)\n...\n>>>\n>>>\n>>> valid_user()\nUser: UserValid, Usage: 20, Limit: 50000, Email: example@example.com\n20\nhello.\nUser: UserValid, Usage: 24, Limit: 50000, Email: example@example.com\n>>>\n>>> anon_user()\nUser: Anonymous, Usage: 4, Limit: 5000, Email: None\n4\nhello.\nUser: Anonymous, Usage: 8, Limit: 5000, Email: None\n>>>\n```\n\n\n\n\n# MyMemory: API technical specifications\n\n## Get\n\nSearches MyMemory for matches against a segment.\n\nCall example:\n\n<a href='https://api.mymemory.translated.net/get?q=Hello World!&langpair=en|it'>https://api.mymemory.translated.net/get?q=Hello World!&langpair=en|it</a>\n\n\n|     |     |     |     |\n| --- | --- | --- | --- |\n| \\*\\*Parameter\\*\\* | \\*\\*Description\\*\\* | \\*\\*Type\\*\\* | \\*\\*Example value\\*\\* |\n| q   | The sentence you want to translate. Use UTF-8. \\*\\*Max 500 bytes\\*\\* | Mandatory | Hello World! |\n| langpair | Source and language pair, separated by the \\| symbol. Use ISO standard names or RFC3066 | Mandatory | en\\|it |\n| mt  | Enables Machine Translation in results. You can turn it off if you want just human segments | Optional | 1 (default), 0 |\n| key | Authenticates the request; matches from your private TM are returned too. \\*\\*Get your key \\[here\\](keygen.php) or use the keygen API\\*\\* | Optional |     |\n| onlyprivate | If your request is authenticated, returns only matches from your private TM | Optional | 0 (default), 1 |\n| ip  | The IP of the end user generating the request. \\*\\*Recommended for CAT tools and high volume usage\\*\\* Originating IP is always overridden by \\_X-Forwarded-For\\_ header, if the latter is set | Optional | 93.81.217.71 |\n| de  | A valid email where we can reach you in case of troubles. \\*\\*Recommended for CAT tools and high volume usage\\*\\* | Optional | user@yourdomain.com |\n| user | Authenticates the request; matches from your private TM are returned too | Optional, but needs the key parameter. Kept for backward compatibility only: now the \\*\\*key\\*\\* parameter alone is sufficient |     |\n\n## Keygen\n\nGenerates the key associated with a username.\n\nCall example:\n\n<a href='https://api.mymemory.translated.net/keygen?user=username&pass=password'>https://api.mymemory.translated.net/keygen?user=username&pass=password</a>\n\n\n\nParameter description:\n\n|     |     |     |     |\n| --- | --- | --- | --- |\n| **Parameter** | **Description** | **Type** | **Example value** |\n| user | The username whose key we want to generate | Mandatory |     |\n| pass | The password associated with the username | Mandatory |     |\n\n\n<a name=\"API-usage-limits\"></a>\n\n# API usage limits\n\n## Get\n\nSearches MyMemory for matches against a segment.\n\nMyMemory tracks it usage in words. This means that it doesn't matter how many requests you submit to consult the archive, but the weight of each request.\n\n> **Free, anonymous usage is limited to <u>5000 chars/day</u>.**\n\n> **Provide a valid email ('de' parameter), where we can reach you in case of troubles, and enjoy <u>50000 chars/day</u>.**\n\nAre you a CAT tool maker? Get whitelisted! Write us and get 150000 chars/day!*\n\nIf you are interested in even larger volumes, have a look at our RapidAPI plans!\n\nDon't forget to check out carefully our Terms of Service, also.\n\n* Note for developers:\nPlease bear in mind that we are eager to include in whitelisting program only estabilished projects of interest (have a look at \"Most popular CAT tools\" under CAT section, to get an idea of required market share).\nPersonal projects or \"in development\" stuff, projects that just use the \"get\" endpoint without contributing to MyMemory using the \"set\" endpoint, never qualify for the whitelisting.\nRequests failing in complying with such minimum directive will be disregarded.\n\n\n## Keygen\n\nGenerates the key associated with a username.\n\nTo prevent abuse, we keep track of call rate and enforce limits when necessary.\n\n\n## Set\n\nContributes a translation unit (segment and translation) in some language pair to MyMemory.\n\nThis is never limited.\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-or-later",
    "summary": "Translate phrases or texts using the Mymemory API in a simple way.",
    "version": "0.1.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/kurotom/MyMemoPy/issues",
        "Homepage": "https://github.com/kurotom/MyMemoPy",
        "Repository": "https://github.com/kurotom/MyMemoPy"
    },
    "split_keywords": [
        "translator",
        "translation",
        "api",
        "mymemory api",
        "simple"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9aae1b93b862328671aed91fd887fb90ec225ef138a554d6e5ed029adc9714b2",
                "md5": "260376a9c2dc4d80debf3c7647e93616",
                "sha256": "63e96ab17f581b3b58d55ed11fe4775cdeaf64ecef9da29426d2551883ce6d2a"
            },
            "downloads": -1,
            "filename": "mymemopy-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "260376a9c2dc4d80debf3c7647e93616",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 25593,
            "upload_time": "2023-12-14T14:35:50",
            "upload_time_iso_8601": "2023-12-14T14:35:50.135154Z",
            "url": "https://files.pythonhosted.org/packages/9a/ae/1b93b862328671aed91fd887fb90ec225ef138a554d6e5ed029adc9714b2/mymemopy-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "50485070742c5c5c747184f1cd1bf550828b10d2ee0803e98ff614812b3c2245",
                "md5": "2724b2f6098bee0c67d608e7a291deaa",
                "sha256": "60a8619f56b1d26ca0bdcb3c4adb266277c879dd0b600158709df1782fa29ea1"
            },
            "downloads": -1,
            "filename": "mymemopy-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "2724b2f6098bee0c67d608e7a291deaa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4.0",
            "size": 24716,
            "upload_time": "2023-12-14T14:35:52",
            "upload_time_iso_8601": "2023-12-14T14:35:52.289935Z",
            "url": "https://files.pythonhosted.org/packages/50/48/5070742c5c5c747184f1cd1bf550828b10d2ee0803e98ff614812b3c2245/mymemopy-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-14 14:35:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kurotom",
    "github_project": "MyMemoPy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "mymemopy"
}
        
Elapsed time: 0.22380s