Skip to content

Commit 863d0c9

Browse files
committed
Feat: Allow usage of atlassian-python-api without BeautifulSoup by set it as extra dependency
1 parent fdaf1ff commit 863d0c9

File tree

5 files changed

+20
-4
lines changed

5 files changed

+20
-4
lines changed

README.rst

+6
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ From PyPI
3535
3636
$ pip install atlassian-python-api
3737
38+
And if you want to use Crowd() or Confluence()
39+
40+
.. code-block:: console
41+
42+
$ pip install atlassian-python-api[html]
43+
3844
From Source
3945

4046
- Git clone repository

atlassian/confluence.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
from typing import cast
99

1010
import requests
11-
from bs4 import BeautifulSoup
11+
try:
12+
from bs4 import BeautifulSoup
13+
except ImportError:
14+
raise ImportError("Please install atlassian-python-api with extra=html like `pip install atlassian-python-api[html]`.")
1215
from deprecated import deprecated
1316
from requests import HTTPError
1417

atlassian/crowd.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
import logging
33

44
from jmespath import search
5-
from bs4 import BeautifulSoup
5+
try:
6+
from bs4 import BeautifulSoup
7+
except ImportError:
8+
raise ImportError("Please install atlassian-python-api with extra=html like `pip install atlassian-python-api[html]`.")
69

710
from .rest_client import AtlassianRestAPI
811

docs/index.rst

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ Install package using pip:
1515

1616
``pip install atlassian-python-api``
1717

18+
and if you want to use Crowd() or Confluence() use:
19+
20+
``pip install atlassian-python-api[html]``
21+
1822
Add a connection:
1923

2024
.. code-block:: python

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
package_dir={"atlassian": "atlassian"},
2727
include_package_data=True,
2828
zip_safe=False,
29-
install_requires=["deprecated", "requests", "oauthlib", "requests_oauthlib", "jmespath", "beautifulsoup4", "typing-extensions"],
30-
extras_require={"kerberos": ["requests-kerberos"]},
29+
install_requires=["deprecated", "requests", "oauthlib", "requests_oauthlib", "jmespath", "typing-extensions"],
30+
extras_require={"kerberos": ["requests-kerberos"], "html": ["beautifulsoup4"]},
3131
platforms="Platform Independent",
3232
classifiers=[
3333
"Development Status :: 4 - Beta",

0 commit comments

Comments
 (0)