我遇到了Jira Rest API的一个非常奇怪的问题 - 当我尝试使用POST请求创建问题或者使用PUT请求更新一个请求到jira / rest / api / latest / issue /我收到来自Python 2.7请求的错误代码400,但它从Powershell的Invoke Web Request成功。
但是,我能够使用GET请求从Jira服务器提取信息,包括:
我已经尝试了来自Atlassian支持网站的类似主题的一些故障排除建议:
Json Body(Raw):
{"fields": {"issuetype": {"id": "10702"}, "project": {"id": "10061"}, "description": "Execution for Issue: SDBX-859", "summary": "Execution for Issue: SDBX-859"}}
(格式化为易读性):
{
"fields": {
"issuetype": {
"id": "10702"
},
"project": {
"id": "10061"
},
"description": "Execution for Issue: SDBX-859",
"summary": "Execution for Issue: SDBX-859"
}
}
流程从这个类开始:
class Migrator(object):
RestURLs = {
"projects": "api/latest/project",
"issuetype": "api/latest/issuetype",
"fields": "api/latest/field",
"tests": "api/latest/search?maxResults={limit}&expand=meta&jql=IssueType='{testType}'+and+project={projectKey}",
"zSteps": "zapi/latest/teststep/{issueId}",
"zExecutions": "zapi/latest/zql/executeSearch?zqlQuery=project={projectKey}",
"zCycles": "zapi/latest/cycle?projectId={projectId}",
"issue": "api/latest/issue/{issueKey}",
"xSteps": "raven/1.0/api/test/{issueKey}/step/{stepId}",
"xSet": "raven/1.0/api/testset/{issueKey}/test",
"xExecution": "raven/1.0/api/testexec/{issueKey}/test"
}
CustomFields = {
"Zephyr Teststep": "",
"Manual Test Steps": "",
"Test Type": ""
}
IssueNames = {
"zephyr":"Zephyr - Test",
"xray":"Test",
"set":"Test Set",
"execution":"Test Execution"
}
IssueTypes = {}
def __init__(self):
self.results = []
print("new Migrator initialised")
self.restHandler = RestHandler()
self.baseURL = "http://127.0.0.1/jira/rest/"
self.authentication = ""
self.commonHeaders = {}
self.projectList = []
self.project = None
self.testList = []
self.executionList = {}
self.versionList = set()
self.cycleList = {}
self.setList = []
def connect(self, username, password, serverUrl="http://127.0.0.1"):
# 1 - connect to jira
if serverUrl[-1] != '/':
serverUrl += '/'
self.baseURL = str.format("{0}jira/rest/", serverUrl)
self.authentication = "Basic " + base64.b64encode(username + ":" + password)
self.commonHeaders = {"Authorization": self.authentication}
print("Connecting to Server: " + self.baseURL)
headers = self.commonHeaders
projList = self.restHandler.perform(method=HTTP.GET,url=self.baseURL,path=Migrator.RestURLs["projects"],headers=headers)
# 2 - populate projects list
for projDict in projList:
self.projectList.append(Project().fromDict(projDict))
从这个方法:
def migrateExecutions(self, project):
print "working..."
for execution in self.executionList:
# Restricting it only to my issues for testing...
if execution.assigneeUserName == "boydnic":
headers = self.commonHeaders
execData = {"fields":{}}
execData["fields"]["issuetype"] = {"id":self.IssueTypes[self.IssueNames["execution"]].id}
execData["fields"]["project"] = {"id":project.id}
# execData["fields"]["reporter"] = {"name": userName}
# execData["fields"]["assignee"] = {"name": execution.assigneeUserName}
execData["fields"]["summary"] = "Execution for Issue: " + execution.issueKey
execData["fields"]["description"] = execution.comment if execution.comment else execData["fields"]["summary"]
xrayExec = self.createIssue(execData)
self.results.append(self.restHandler.perform(method=HTTP.POST, url=self.baseURL,
path=self.RestURLs["xExecution"], urlData={"issueKey":xrayExec.key},
headers=headers, body={"add":[execution.issueKey]}))
到这个方法:
def createIssue(self, issueTemplate):
result = self.restHandler.perform(method=HTTP.POST, url=self.baseURL, path=Migrator.RestURLs["issue"], urlData={"issueKey":""}, headers=self.commonHeaders, body=issueTemplate)
issue = Issue()
issue.id = result["id"]
issue.key = result["key"]
issue.self = result["self"]
print("Created Issue: "+issue.key)
return issue
它本身称之为这个类:
class RestHandler(object):
def __init__(self):
self.headerStore = {'X-CITNET-USER':"",
'X-ASEN':"",
'X-ASESSIONID':"",
'X-AUSERNAME':""}
self.cookieJar = requests.cookies.RequestsCookieJar()
def perform(self, method, url, path, headers={}, urlData={"projectId": "", "projectKey": "", "issueId": "", "issueKey": ""},
formData=dict(), body=""):
resultData = "{}"
path = url + path.format(**urlData)
body = body if isinstance(body, str) else json.dumps(body)
if self.headerStore:
headers.update(self.headerStore)
jar = self.cookieJar
print(str(method))
print(path)
if method is HTTP.GET:
resultData = requests.get(path, headers=headers, cookies = jar)
elif method is HTTP.POST:
print (body)
path = path.rstrip('/')
resultData = requests.post(path, json=body, headers=headers, cookies = jar)
elif method is HTTP.PUT:
print (body)
resultData = requests.put(path, json=body, headers=headers, cookies = jar)
elif method is HTTP.DELETE:
request = "DELETE request to " + path
else:
raise TypeError
print("\n\n===============================\nRest Call Debugging\n===============================")
print(resultData)
print(resultData.url)
print(resultData.status_code)
print(resultData.headers)
print(resultData.content)
print("\n\n===============================\n/Rest Call Debugging\n==============================")
if 199 < resultData.status_code < 300:
for hKey, hValue in resultData.headers.iteritems():
if hKey in self.headerStore.keys():
self.headerStore[hKey] = hValue
self.cookieJar.update(resultData.cookies)
print "testing breakpoint"
return json.loads(resultData.content)
else:
raise IOError(resultData.reason)
Rest Handler类中包含的Debugging部分只是吐出以下内容:
===============================
Rest Call Debugging
===============================
https://webgate.test.ec.europa.eu/CITnet/jira/rest/api/latest/issue
400
{'X-AUSERNAME': 'boydnic', 'X-AREQUESTID': '<redacted>', 'X-Content-Type-Options': 'nosniff', 'Transfer-Encoding': 'chunked', 'Set-Cookie': 'crowd.token_key=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly, crowd.token_key=<redacted>; Path=/; HttpOnly, JSESSIONID=<redacted>; Path=/CITnet/jira; HttpOnly, atlassian.xsrf.token=<redacted>; Path=/CITnet/jira', 'X-Seraph-LoginReason': 'OUT, OK', 'X-ASEN': '<redacted>', 'X-CITNET-USER': 'boydnic', 'Connection': 'Keep-Alive', 'X-ASESSIONID': '<redacted>', 'Cache-Control': 'no-cache, no-store, no-transform, proxy-revalidate', 'Date': 'Tue, 24 Apr 2018 08:29:16 GMT', 'Server': 'Apache-Coyote/1.1', 'Content-Type': 'application/json;charset=UTF-8'}
{"errorMessages":["Can not instantiate value of type [simple type, class com.atlassian.jira.rest.v2.issue.IssueUpdateBean] from JSON String; no single-String constructor/factory method"]}
===============================
/Rest Call Debugging
==============================
将此I / O错误与它混合在一起:
(我为这篇文章解开了STD和ERR流)
Traceback (most recent call last): File
"C:/Users/BOYDnic/Documents/migrator/issueMigrator.py", line 546, in
<module> <Response [400]>
jiraMigrator.migrate(projectKey)
File "C:/Users/BOYDnic/Documents/migrator/issueMigrator.py", line 330, in migrate
self.migrateExecutions(project) File "C:/Users/BOYDnic/Documents/migrator/issueMigrator.py", line 475, in
migrateExecutions
xrayExec = self.createIssue(execData) File "C:/Users/BOYDnic/Documents/migrator/issueMigrator.py", line 334, in
createIssue
result = self.restHandler.perform(method=HTTP.POST, url=self.baseURL, path=Migrator.RestURLs["issue"],
urlData={"issueKey":""}, headers=self.commonHeaders,
body=issueTemplate) File
"C:/Users/BOYDnic/Documents/migrator/issueMigrator.py", line 84, in
perform
raise IOError(resultData.reason) IOError: Bad Request
我对此感到非常沮丧,尤其是因为它阻止了此迁移脚本的完成,似乎毫无意义。
答案 0 :(得分:1)
当请求正文格式不正确时,Jira会返回类似“无法实例化类型的值...”的错误。在您的情况下,您提供了一个字符串,其中Jira期望更复杂的内容(通常是字典)。
答案 1 :(得分:1)
事实证明,我使用/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/DecafRuntime.cpp:72: undefined reference to `apr_initialize'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/DecafRuntime.cpp:73: undefined reference to `apr_pool_create_ex'
libactivemq-cpp.a(libactivemq_cpp_la-DecafRuntime.o): In function `decaf::lang::Runtime::shutdownRuntime()':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/DecafRuntime.cpp:109: undefined reference to `apr_pool_destroy'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/DecafRuntime.cpp:110: undefined reference to `apr_terminate'
libactivemq-cpp.a(libactivemq_cpp_la-Network.o): In function `decaf::internal::net::Network::initializeNetworking()':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/Network.cpp:116: undefined reference to `apr_signal_block'
libactivemq-cpp.a(libactivemq_cpp_la-SecureRandomImpl.o): In function `decaf::internal::security::SecureRandomImpl::providerNextBytes(unsigned char*, int)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/security/unix/SecureRandomImpl.cpp:128: undefined reference to `apr_file_read_full'
libactivemq-cpp.a(libactivemq_cpp_la-SecureRandomImpl.o): In function `decaf::internal::security::SecureRandomImpl::SecureRandomImpl()':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/security/unix/SecureRandomImpl.cpp:76: undefined reference to `apr_file_open'
libactivemq-cpp.a(libactivemq_cpp_la-Exception.o): In function `decaf::lang::Exception::buildMessage(char const*, __va_list_tag (&) [1])':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/lang/Exception.cpp:124: undefined reference to `apr_pvsprintf'
libactivemq-cpp.a(libactivemq_cpp_la-System.o): In function `decaf::lang::System::unsetenv(std::string const&)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/lang/System.cpp:276: undefined reference to `apr_env_delete'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/lang/System.cpp:286: undefined reference to `apr_strerror'
libactivemq-cpp.a(libactivemq_cpp_la-System.o): In function `decaf::lang::System::getenv(std::string const&)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/lang/System.cpp:297: undefined reference to `apr_env_get'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/lang/System.cpp:306: undefined reference to `apr_strerror'
libactivemq-cpp.a(libactivemq_cpp_la-System.o): In function `decaf::lang::System::setenv(std::string const&, std::string const&)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/lang/System.cpp:326: undefined reference to `apr_env_set'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/lang/System.cpp:336: undefined reference to `apr_strerror'
libactivemq-cpp.a(libactivemq_cpp_la-InetAddress.o): In function `decaf::net::InetAddress::getLocalHost()':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/net/InetAddress.cpp:158: undefined reference to `apr_gethostname'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/net/InetAddress.cpp:168: undefined reference to `apr_sockaddr_info_get'
libactivemq-cpp.a(libactivemq_cpp_la-AprPool.o): In function `decaf::internal::AprPool::destroyPool()':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/AprPool.cpp:50: undefined reference to `apr_pool_destroy'
libactivemq-cpp.a(libactivemq_cpp_la-AprPool.o): In function `decaf::internal::AprPool::allocatePool() const':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/AprPool.cpp:42: undefined reference to `apr_pool_create_unmanaged_ex'
libactivemq-cpp.a(libactivemq_cpp_la-AprPool.o): In function `decaf::internal::AprPool::cleanup()':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/AprPool.cpp:60: undefined reference to `apr_pool_clear'
libactivemq-cpp.a(libactivemq_cpp_la-TcpSocket.o): In function `decaf::internal::net::tcp::TcpSocket::connect(std::string const&, int, int)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/tcp/TcpSocket.cpp:312: undefined reference to `apr_sockaddr_info_get'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/tcp/TcpSocket.cpp:318: undefined reference to `apr_socket_opt_get'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/tcp/TcpSocket.cpp:319: undefined reference to `apr_socket_timeout_get'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/tcp/TcpSocket.cpp:322: undefined reference to `apr_socket_opt_set'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/tcp/TcpSocket.cpp:328: undefined reference to `apr_socket_timeout_set'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/tcp/TcpSocket.cpp:332: undefined reference to `apr_socket_connect'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/tcp/TcpSocket.cpp:335: undefined reference to `apr_socket_opt_set'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/tcp/TcpSocket.cpp:336: undefined reference to `apr_socket_timeout_set'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/tcp/TcpSocket.cpp:326: undefined reference to `apr_socket_timeout_set'
libactivemq-cpp.a(libactivemq_cpp_la-TcpSocket.o): In function `decaf::internal::net::tcp::TcpSocket::available()':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/tcp/TcpSocket.cpp:417: undefined reference to `apr_os_sock_get'
libactivemq-cpp.a(libactivemq_cpp_la-TcpSocket.o): In function `decaf::internal::net::tcp::TcpSocket::getLocalAddress() const':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/tcp/TcpSocket.cpp:376: undefined reference to `apr_socket_addr_get'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/tcp/TcpSocket.cpp:378: undefined reference to `apr_sockaddr_ip_getbuf'
libactivemq-cpp.a(libactivemq_cpp_la-TcpSocket.o): In function `decaf::internal::net::tcp::TcpSocket::getOption(int) const':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/tcp/TcpSocket.cpp:571: undefined reference to `apr_socket_opt_get'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/tcp/TcpSocket.cpp:541: undefined reference to `apr_socket_timeout_get'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/tcp/TcpSocket.cpp:545: undefined reference to `apr_socket_opt_get'
libactivemq-cpp.a(libactivemq_cpp_la-TcpSocket.o): In function `decaf::internal::net::tcp::TcpSocket::setOption(int, int)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/tcp/TcpSocket.cpp:621: undefined reference to `apr_socket_opt_set'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/tcp/TcpSocket.cpp:591: undefined reference to `apr_socket_opt_set'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/tcp/TcpSocket.cpp:593: undefined reference to `apr_socket_timeout_set'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/tcp/TcpSocket.cpp:603: undefined reference to `apr_socket_opt_set'
libactivemq-cpp.a(libactivemq_cpp_la-TcpSocket.o): In function `decaf::internal::net::tcp::TcpSocket::read(unsigned char*, int, int, int)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/tcp/TcpSocket.cpp:675: undefined reference to `apr_socket_recv'
libactivemq-cpp.a(libactivemq_cpp_la-TcpSocket.o): In function `decaf::internal::net::tcp::TcpSocket::write(unsigned char const*, int, int, int)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/tcp/TcpSocket.cpp:745: undefined reference to `apr_socket_send'
libactivemq-cpp.a(libactivemq_cpp_la-TcpSocket.o): In function `decaf::internal::net::tcp::TcpSocket::create()':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/tcp/TcpSocket.cpp:157: undefined reference to `apr_socket_create'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/tcp/TcpSocket.cpp:161: undefined reference to `apr_os_sock_get'
libactivemq-cpp.a(libactivemq_cpp_la-TcpSocket.o): In function `decaf::internal::net::tcp::TcpSocket::accept(decaf::net::SocketImpl*)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/net/SocketError.cpp:42: undefined reference to `apr_strerror'
libactivemq-cpp.a(libactivemq_cpp_la-Date.o): In function `decaf::util::Date::toString() const':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/util/Date.cpp:112: undefined reference to `apr_time_exp_lt'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/util/Date.cpp:117: undefined reference to `apr_strftime'
libactivemq-cpp.a(libactivemq_cpp_la-OpenSSLContextSpi.o): In function `decaf::internal::net::ssl::openssl::OpenSSLContextSpi::providerInit(decaf::security::SecureRandom*)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.cpp:188: undefined reference to `SSL_load_error_strings'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.cpp:189: undefined reference to `SSL_library_init'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.cpp:190: undefined reference to `OPENSSL_add_all_algorithms_noconf'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.cpp:226: undefined reference to `SSL_CTX_use_PrivateKey_file'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.cpp:245: undefined reference to `SSL_CTX_load_verify_locations'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.cpp:253: undefined reference to `RAND_seed'
libactivemq-cpp.a(libactivemq_cpp_la-OpenSSLContextSpi.o): In function `decaf::internal::net::ssl::openssl::OpenSSLContextSpi::~OpenSSLContextSpi()':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.cpp:162: undefined reference to `CRYPTO_set_locking_callback'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.cpp:163: undefined reference to `EVP_cleanup'
libactivemq-cpp.a(libactivemq_cpp_la-OpenSSLContextSpi.o): In function `~ContextData':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/ssl/openssl/OpenSSLContextSpi.cpp:110: undefined reference to `SSL_CTX_free'
libactivemq-cpp.a(libactivemq_cpp_la-OpenSSLSocketException.o): In function `decaf::internal::net::ssl::openssl::OpenSSLSocketException::getErrorString() const':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocketException.cpp:102: undefined reference to `ERR_get_error'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocketException.cpp:104: undefined reference to `ERR_error_string_n'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocketException.cpp:102: undefined reference to `ERR_get_error'
libactivemq-cpp.a(libactivemq_cpp_la-OpenSSLParameters.o): In function `decaf::internal::net::ssl::openssl::OpenSSLParameters::OpenSSLParameters(ssl_ctx_st*)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp:573: undefined reference to `SSL_write'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp:575: undefined reference to `SSL_get_error'
libactivemq-cpp.a(libactivemq_cpp_la-OpenSSLSocket.o): In function `decaf::internal::net::ssl::openssl::OpenSSLSocket::available()':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp:641: undefined reference to `X509_free'
libactivemq-cpp.a(libactivemq_cpp_la-OpenSSLSocket.o): In function `decaf::internal::net::ssl::openssl::OpenSSLSocket::verifyServerCert(std::string const&)':
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp:686: undefined reference to `X509_get_subject_name'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp:692: undefined reference to `X509_NAME_get_index_by_NID'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp:367: undefined reference to `SSL_ctrl'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp:370: undefined reference to `SSL_connect'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp:376: undefined reference to `SSL_get_error'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp:406: undefined reference to `SSL_set_verify'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp:408: undefined reference to `SSL_accept'
/home/isammour/Desktop/smart/activemq-cpp-library-3.9.4/src/main/decaf/internal/net/ssl/openssl/OpenSSLSocket.cpp:361: undefined reference to `SSL_set_verify'
与json.dumps(body)
相结合导致了这个问题。
使用json关键字告诉Requests再次序列化字符串,转义&#34;标记为\&#34;并再次用引号括起来。
有效:
put(..., json=body, ...)
变成了:
{"fields": {"issuetype": {"id": 10702},"project": {"id":10061},"description": "","summary": "Execution for Issue: SDBX-859"}}
将"{\"fields\": {\"issuetype\": {\"id\": \"10702\"}, \"project\": {\"id\": \"10061\"}, \"description\": \"Execution for Issue: SDBX-859\", \"summary\": \"Execution for Issue: SDBX-859\"}}"
与手动设置的内容标题一起使用,或body=json.dumps({...})
不要同时使用。{/ p>