How to use the telegraph.Telegraph function in telegraph

To help you get started, we’ve selected a few telegraph examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github python273 / telegraph / tests / test_telegraph.py View on Github external
def test_get_page(self):
        telegraph = Telegraph()
        response = telegraph.get_page('Hey-01-17-2', return_html=False)

        self.assertEqual(
            response['content'],
            [{'tag': 'p', 'children': ['Hello, world!']}]
        )
github python273 / telegraph / tests / test_telegraph.py View on Github external
def test_get_page_html(self):
        telegraph = Telegraph()
        response = telegraph.get_page('Hey-01-17-2')

        self.assertEqual(response['content'], '<p>Hello, world!</p>')
github python273 / telegraph / tests / test_telegraph.py View on Github external
def test_get_page_without_content(self):
        telegraph = Telegraph()
        response = telegraph.get_page('Hey-01-17-2', return_content=False)

        self.assertTrue('content' not in response)
github python273 / telegraph / tests / test_telegraph.py View on Github external
def test_flow(self):
        telegraph = Telegraph()

        response = telegraph.create_account(
            short_name='python telegraph',
            author_name='Python Telegraph API wrapper',
            author_url='https://github.com/python273/telegraph'
        )
        self.assertTrue('access_token' in response)
        self.assertTrue('auth_url' in response)

        response = telegraph.get_account_info()
        self.assertEqual(response['short_name'], 'python telegraph')

        response = telegraph.edit_account_info(
            short_name='Python Telegraph Wrapper'
        )
        self.assertEqual(response['short_name'], 'Python Telegraph Wrapper')