Skip to content

Commit 8f1e74b

Browse files
committed
black formatting
1 parent 8a45444 commit 8f1e74b

File tree

6 files changed

+167
-136
lines changed

6 files changed

+167
-136
lines changed

samples/unauthenticated_server_info.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@
1414

1515
def main():
1616

17-
server = '' # Use a link from http://webhook.site to troubleshoot outgoing requests
17+
server = "" # Use a link from http://webhook.site to troubleshoot outgoing requests
1818

1919
server = TSC.Server(server)
2020
print(server)
2121
server.use_highest_version()
2222

23-
if __name__ == '__main__':
23+
24+
if __name__ == "__main__":
2425
main()

setup.py

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,44 @@
77
from distutils.core import setup
88

99
from os import path
10+
1011
this_directory = path.abspath(path.dirname(__file__))
11-
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
12+
with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
1213
long_description = f.read()
1314

1415
# Only install pytest and runner when test command is run
1516
# This makes work easier for offline installs or low bandwidth machines
16-
needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
17-
pytest_runner = ['pytest-runner'] if needs_pytest else []
18-
test_requirements = ['black', 'mock', 'pytest', 'requests-mock>=1.0,<2.0', 'mypy>=0.920']
17+
needs_pytest = {"pytest", "test", "ptr"}.intersection(sys.argv)
18+
pytest_runner = ["pytest-runner"] if needs_pytest else []
19+
test_requirements = ["black", "mock", "pytest", "requests-mock>=1.0,<2.0", "mypy>=0.920"]
1920

2021
setup(
21-
name='tableauserverclient',
22+
name="tableauserverclient",
2223
version=versioneer.get_version(),
2324
cmdclass=versioneer.get_cmdclass(),
24-
author='Tableau',
25-
author_email='github@tableau.com',
26-
url='https://github.com/tableau/server-client-python',
27-
package_data={'tableauserverclient':['py.typed']},
28-
packages=['tableauserverclient',
29-
'tableauserverclient.helpers',
30-
'tableauserverclient.models',
31-
'tableauserverclient.server',
32-
'tableauserverclient.server.endpoint'],
33-
license='MIT',
34-
description='A Python module for working with the Tableau Server REST API.',
25+
author="Tableau",
26+
author_email="github@tableau.com",
27+
url="https://github.com/tableau/server-client-python",
28+
package_data={"tableauserverclient": ["py.typed"]},
29+
packages=[
30+
"tableauserverclient",
31+
"tableauserverclient.helpers",
32+
"tableauserverclient.models",
33+
"tableauserverclient.server",
34+
"tableauserverclient.server.endpoint",
35+
],
36+
license="MIT",
37+
description="A Python module for working with the Tableau Server REST API.",
3538
long_description=long_description,
36-
long_description_content_type='text/markdown',
37-
test_suite='test',
39+
long_description_content_type="text/markdown",
40+
test_suite="test",
3841
setup_requires=pytest_runner,
3942
install_requires=[
40-
'defusedxml>=0.7.1',
41-
'requests>=2.20,<3.0',
43+
"defusedxml>=0.7.1",
44+
"requests>=2.20,<3.0",
4245
],
43-
python_requires='>3.7.0',
46+
python_requires=">3.7.0",
4447
tests_require=test_requirements,
45-
extras_require={
46-
'test': test_requirements
47-
},
48-
zip_safe=False
48+
extras_require={"test": test_requirements},
49+
zip_safe=False,
4950
)

tableauserverclient/server/endpoint/endpoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def _make_common_headers(auth_token, content_type):
3737
headers["x-tableau-auth"] = auth_token
3838
if content_type is not None:
3939
headers["content-type"] = content_type
40-
headers["User-Agent"] = "Tableau Server Client {}".format(get_versions()['version'])
40+
headers["User-Agent"] = "Tableau Server Client {}".format(get_versions()["version"])
4141
return headers
4242

4343
def _make_request(

tableauserverclient/server/server.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
from ..namespace import Namespace
3838

3939
from tableauserverclient._version import get_versions
40+
4041
__TSC_VERSION__ = get_versions()["version"]
4142
del get_versions
4243

test/test_requests.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,17 @@ def test_make_post_request(self):
3232
with requests_mock.mock() as m:
3333
m.post(requests_mock.ANY)
3434
url = "http://test/api/2.3/sites/dad65087-b08b-4603-af4e-2887b8aafc67/workbooks"
35-
resp = self.server.workbooks._make_request(requests.post, url, content=b'1337',
36-
auth_token='j80k54ll2lfMZ0tv97mlPvvSCRyD0DOM',
37-
content_type='multipart/mixed')
38-
self.assertEqual(resp.request.headers['x-tableau-auth'], 'j80k54ll2lfMZ0tv97mlPvvSCRyD0DOM')
39-
self.assertEqual(resp.request.headers['content-type'], 'multipart/mixed')
40-
self.assertTrue(re.search('Tableau Server Client', resp.request.headers['user-agent']))
41-
self.assertEqual(resp.request.body, b'1337')
35+
resp = self.server.workbooks._make_request(
36+
requests.post,
37+
url,
38+
content=b"1337",
39+
auth_token="j80k54ll2lfMZ0tv97mlPvvSCRyD0DOM",
40+
content_type="multipart/mixed",
41+
)
42+
self.assertEqual(resp.request.headers["x-tableau-auth"], "j80k54ll2lfMZ0tv97mlPvvSCRyD0DOM")
43+
self.assertEqual(resp.request.headers["content-type"], "multipart/mixed")
44+
self.assertTrue(re.search("Tableau Server Client", resp.request.headers["user-agent"]))
45+
self.assertEqual(resp.request.body, b"1337")
4246

4347
# Test that 500 server errors are handled properly
4448
def test_internal_server_error(self):

0 commit comments

Comments
 (0)