![](/img/trans.png)
[英]Accessing API: TypeError: __init__() got an unexpected keyword argument 'encoding'
[英]"TypeError: __init__() got an unexpected keyword argument 'headers'" Error when importing TCMS from tcms_api
我正在運行 Python 3.8.3
從以下代碼中, from tcms_api import TCMS
拋出錯誤。
from tcms_api import TCMS
rpc_client = TCMS()
test_case = rpc_client.TestCase.create({
'summary': 'My testing',
'product': 2,
'category': 2,
'priority': 1,
'is_automated': True,
'text': 'my first test case',
'case_status': 2, # CONFIRMED
})
錯誤:
Traceback (most recent call last):
File "C:/Users/bokro/PycharmProjects/tcms/Test.py", line 1, in <module>
from tcms_api import TCMS
File "C:\Users\bokro\AppData\Local\Programs\Python\Python38\lib\site-packages\tcms_api\__init__.py", line 81, in <module>
from tcms_api.xmlrpc import TCMSXmlrpc, TCMSKerbXmlrpc
File "C:\Users\bokro\AppData\Local\Programs\Python\Python38\lib\site-packages\tcms_api\xmlrpc.py", line 130, in <module>
class TCMSKerbXmlrpc(TCMSXmlrpc):
File "C:\Users\bokro\AppData\Local\Programs\Python\Python38\lib\site-packages\tcms_api\xmlrpc.py", line 137, in TCMSKerbXmlrpc
transport = KerbTransport()
File "C:\Users\bokro\AppData\Local\Programs\Python\Python38\lib\xmlrpc\client.py", line 1351, in __init__
super().__init__(use_datetime=use_datetime,
TypeError: __init__() got an unexpected keyword argument 'headers'
Process finished with exit code 1
我在網上無休止地到處尋找,卻找不到有同樣問題的人。 我想知道是否有人遇到過這個問題或知道如何解決它。 對此的任何幫助將不勝感激。
解決方案:對於遇到相同問題的任何人,我已經通過降級到 Python 3.6 解決了這個問題。 API 好像不兼容3.8。 希望這對某人有所幫助。
解決方案:對於遇到相同問題的任何人,我已經通過降級到 Python 3.6 解決了這個問題。 API 好像不兼容3.8。 希望這對某人有所幫助。
很高興看到您能夠解決這個問題。 特別是傳輸類,在您的情況下, KerbTransport()
繼承自 Python 中的 standard.networking 傳輸類,這些類因版本而異。
tcms-api
目前僅在 Python 3.6 上開發和測試。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.