hubspot-article-translator


Namehubspot-article-translator JSON
Version 0.1.1 PyPI version JSON
download
home_page
SummaryTranslating Hubspot Articles
upload_time2023-08-30 04:00:08
maintainer
docs_urlNone
authormattcoulter7 (Matt Coulter)
requires_python
license
keywords python hubspot translation knowledgebase articles
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Hubspot-Article-Translator

Auto translation of Hubspot Knowledgebase Articles powered by Selenium



## Important Disclaimer

This application only performs upserts to **DRAFT** articles. It will never modify an article that is published.



## Demo Videos

https://github.com/noodle-factory/Hubspot-Article-Translator/assets/53892067/da218794-033d-45fd-9d80-330ca62ba9d5



## Installation

1. Install Google Chrome; This module depends on a chrome driver, so selenium can leverage off of it.

2. `pip install hubspot-Article-Translator`



## How to use module

### Configuring Translation APIs

#### AWS API

```python

import boto3

from hubspot_article_translator import translation_manager, AWSTranslateClient





if __name__ == "__main__":

    # Setup Translation Client/s

    boto3.setup_default_session()

    translation_manager.add_clients(

        AWSTranslateClient(

            aws_session=boto3.DEFAULT_SESSION

        )

    )

```



#### Azure API

```python

from hubspot_article_translator import translation_manager, AzureTranslateClient





if __name__ == "__main__":

    # Setup Translation Client/s

    translation_manager.add_clients(

        AzureTranslateClient(

            key="<AZURE_TRANSLATE_KEY>",

            location="<AZURE_TRANSLATE_LOCATION>",

            endpoint="<AZURE_TRANSLATE_ENDPOINT>",

            api_version="<AZURE_TRANSLATE_API_VERSION>"

        )

    )

```



### Executing the translation workflow

```python

import boto3

from selenium import webdriver

from hubspot_article_translator import State, workflow, translation_manager, AWSTranslateClient, AzureTranslateClient





if __name__ == "__main__":

    # Create the selenium Chrome driver

    driver = webdriver.Chrome()



    # Execute the workflow, passing parameters into State object

    workflow.execute(

        driver=driver,

        state=State(

            # Your Hubspot Account Email

            email="<HUBSPOT EMAIL>",



            # Your Hubspot Account Password

            password="<HUBSPOT PASSWORD>",



            # 2FA code from Authenticator App

            code="<HUBSPOT 2FA CODE>",



            # List of article IDs to translate

            article_ids=["<ID OF ARTICLE TO TRANSLATE>", ...],



            # The ID of the knowledge base that the above articles are in

            knowledge_base_id="<ID OF THE KNOWLEDGE BASE>",



            # the source language of articles

            from_language="en",



            # the languages each article will be translated to

            # make sure key aligns with content language codes

            # https://github.com/noodle-factory/Hubspot-Article-Translator/blob/master/hubspot_article_translator/translation/content_languages/content_languages.json

            # make sure value is exactly the name of the language in Hubspot

            to_languages={

                "es": "Spanish",

                "pt-pt": "Portuguese - Portugal",

                "id": "Indonesian"

            },



            # Automatically publish the article once translation is done

            # Note ensure that you have setup all the knowledge base category translations for each language...

            # Otherwise you won't be able to publish the articles

            auto_publish=True|False 

        )

    )



    # Close the selenium Driver

    driver.quit()

```



## Tips & tricks

### Getting all the article IDs

It would be time consuming to get all the article IDs from each page manually. Instead, navigate to the knowledge base articles page, then open the console and paste this command

```js

[...document.querySelectorAll('[data-test-object-id]')].map(e => e.getAttribute('data-test-object-id')).join("|")

```



## Known Limitations

1. This hasn't been tested with other browsers, it will likely only work with Chrome currently

2. The account must be configured with 2FA through the authenticator app, and not a mobile phone number


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "hubspot-article-translator",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python,hubspot,translation,knowledgebase,articles",
    "author": "mattcoulter7 (Matt Coulter)",
    "author_email": "<mattcoul7@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/c1/e6/6d30791bcab0527d0e730789d6ebb25647dbd3b4841690229ad45d470b27/hubspot_article_translator-0.1.1.tar.gz",
    "platform": null,
    "description": "\r\n# Hubspot-Article-Translator\r\n\r\nAuto translation of Hubspot Knowledgebase Articles powered by Selenium\r\n\r\n\r\n\r\n## Important Disclaimer\r\n\r\nThis application only performs upserts to **DRAFT** articles. It will never modify an article that is published.\r\n\r\n\r\n\r\n## Demo Videos\r\n\r\nhttps://github.com/noodle-factory/Hubspot-Article-Translator/assets/53892067/da218794-033d-45fd-9d80-330ca62ba9d5\r\n\r\n\r\n\r\n## Installation\r\n\r\n1. Install Google Chrome; This module depends on a chrome driver, so selenium can leverage off of it.\r\n\r\n2. `pip install hubspot-Article-Translator`\r\n\r\n\r\n\r\n## How to use module\r\n\r\n### Configuring Translation APIs\r\n\r\n#### AWS API\r\n\r\n```python\r\n\r\nimport boto3\r\n\r\nfrom hubspot_article_translator import translation_manager, AWSTranslateClient\r\n\r\n\r\n\r\n\r\n\r\nif __name__ == \"__main__\":\r\n\r\n    # Setup Translation Client/s\r\n\r\n    boto3.setup_default_session()\r\n\r\n    translation_manager.add_clients(\r\n\r\n        AWSTranslateClient(\r\n\r\n            aws_session=boto3.DEFAULT_SESSION\r\n\r\n        )\r\n\r\n    )\r\n\r\n```\r\n\r\n\r\n\r\n#### Azure API\r\n\r\n```python\r\n\r\nfrom hubspot_article_translator import translation_manager, AzureTranslateClient\r\n\r\n\r\n\r\n\r\n\r\nif __name__ == \"__main__\":\r\n\r\n    # Setup Translation Client/s\r\n\r\n    translation_manager.add_clients(\r\n\r\n        AzureTranslateClient(\r\n\r\n            key=\"<AZURE_TRANSLATE_KEY>\",\r\n\r\n            location=\"<AZURE_TRANSLATE_LOCATION>\",\r\n\r\n            endpoint=\"<AZURE_TRANSLATE_ENDPOINT>\",\r\n\r\n            api_version=\"<AZURE_TRANSLATE_API_VERSION>\"\r\n\r\n        )\r\n\r\n    )\r\n\r\n```\r\n\r\n\r\n\r\n### Executing the translation workflow\r\n\r\n```python\r\n\r\nimport boto3\r\n\r\nfrom selenium import webdriver\r\n\r\nfrom hubspot_article_translator import State, workflow, translation_manager, AWSTranslateClient, AzureTranslateClient\r\n\r\n\r\n\r\n\r\n\r\nif __name__ == \"__main__\":\r\n\r\n    # Create the selenium Chrome driver\r\n\r\n    driver = webdriver.Chrome()\r\n\r\n\r\n\r\n    # Execute the workflow, passing parameters into State object\r\n\r\n    workflow.execute(\r\n\r\n        driver=driver,\r\n\r\n        state=State(\r\n\r\n            # Your Hubspot Account Email\r\n\r\n            email=\"<HUBSPOT EMAIL>\",\r\n\r\n\r\n\r\n            # Your Hubspot Account Password\r\n\r\n            password=\"<HUBSPOT PASSWORD>\",\r\n\r\n\r\n\r\n            # 2FA code from Authenticator App\r\n\r\n            code=\"<HUBSPOT 2FA CODE>\",\r\n\r\n\r\n\r\n            # List of article IDs to translate\r\n\r\n            article_ids=[\"<ID OF ARTICLE TO TRANSLATE>\", ...],\r\n\r\n\r\n\r\n            # The ID of the knowledge base that the above articles are in\r\n\r\n            knowledge_base_id=\"<ID OF THE KNOWLEDGE BASE>\",\r\n\r\n\r\n\r\n            # the source language of articles\r\n\r\n            from_language=\"en\",\r\n\r\n\r\n\r\n            # the languages each article will be translated to\r\n\r\n            # make sure key aligns with content language codes\r\n\r\n            # https://github.com/noodle-factory/Hubspot-Article-Translator/blob/master/hubspot_article_translator/translation/content_languages/content_languages.json\r\n\r\n            # make sure value is exactly the name of the language in Hubspot\r\n\r\n            to_languages={\r\n\r\n                \"es\": \"Spanish\",\r\n\r\n                \"pt-pt\": \"Portuguese - Portugal\",\r\n\r\n                \"id\": \"Indonesian\"\r\n\r\n            },\r\n\r\n\r\n\r\n            # Automatically publish the article once translation is done\r\n\r\n            # Note ensure that you have setup all the knowledge base category translations for each language...\r\n\r\n            # Otherwise you won't be able to publish the articles\r\n\r\n            auto_publish=True|False \r\n\r\n        )\r\n\r\n    )\r\n\r\n\r\n\r\n    # Close the selenium Driver\r\n\r\n    driver.quit()\r\n\r\n```\r\n\r\n\r\n\r\n## Tips & tricks\r\n\r\n### Getting all the article IDs\r\n\r\nIt would be time consuming to get all the article IDs from each page manually. Instead, navigate to the knowledge base articles page, then open the console and paste this command\r\n\r\n```js\r\n\r\n[...document.querySelectorAll('[data-test-object-id]')].map(e => e.getAttribute('data-test-object-id')).join(\"|\")\r\n\r\n```\r\n\r\n\r\n\r\n## Known Limitations\r\n\r\n1. This hasn't been tested with other browsers, it will likely only work with Chrome currently\r\n\r\n2. The account must be configured with 2FA through the authenticator app, and not a mobile phone number\r\n\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Translating Hubspot Articles",
    "version": "0.1.1",
    "project_urls": null,
    "split_keywords": [
        "python",
        "hubspot",
        "translation",
        "knowledgebase",
        "articles"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "89933716f604229dacfc26695534335497156a0c7547cdc08ffcb13fcc672e36",
                "md5": "6364b90d6baca4892fbb2e95a34b6395",
                "sha256": "72ec1328448305633e080caa6d7d853e7ac8d2940a1698f0fb6c093fb350ec0c"
            },
            "downloads": -1,
            "filename": "hubspot_article_translator-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6364b90d6baca4892fbb2e95a34b6395",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 11505,
            "upload_time": "2023-08-30T04:00:07",
            "upload_time_iso_8601": "2023-08-30T04:00:07.162912Z",
            "url": "https://files.pythonhosted.org/packages/89/93/3716f604229dacfc26695534335497156a0c7547cdc08ffcb13fcc672e36/hubspot_article_translator-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c1e66d30791bcab0527d0e730789d6ebb25647dbd3b4841690229ad45d470b27",
                "md5": "82b78b2773e7f6a3734c36ec35b50a3b",
                "sha256": "79bce8377e2eb9c1dbec6f7dc151a91bc749b908ed9fede0e49356dec0abd124"
            },
            "downloads": -1,
            "filename": "hubspot_article_translator-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "82b78b2773e7f6a3734c36ec35b50a3b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 10661,
            "upload_time": "2023-08-30T04:00:08",
            "upload_time_iso_8601": "2023-08-30T04:00:08.604740Z",
            "url": "https://files.pythonhosted.org/packages/c1/e6/6d30791bcab0527d0e730789d6ebb25647dbd3b4841690229ad45d470b27/hubspot_article_translator-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-30 04:00:08",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "hubspot-article-translator"
}
        
Elapsed time: 0.20594s