Не удается десериализовать экземпляр io.vavr.collection.Seq из VALUE_STRING

Я пытался создать модуль запроса на python, передающий токены API, но каждый раз сталкиваюсь с проблемой, описанной ниже. Делюсь всем своим кодом :

import requests
import json

def bitbucketFunction():
    variables = {"test":"1234"}
    callBitBucketAPI(variables)

def callBitBucketAPI(variables):
  try:
     headers = {
      'Content-Type': 'application/json'
      }
     url = "https:xyz/pipelines/"
     data = {
            "target": {
            "type": "pipeline_ref_target",
            "ref_type": "branch",
            "ref_name": "master",
            "selector": {
            "type": "custom",
            "pattern": "create-aws-account"
             }
            },"variables":json.dumps(variables, indent=2)}    
     response = requests.request("POST",url, auth=('token-key', 'token-value'), data=json.dumps(data),headers=headers)
     print(response.text)
  except Exception as e:
            print("Exception occured in callBitBucketAPI method: ", e)       
 
bitbucketFunction()

Ошибка:

{"error": {"message": "An invalid field was found in the JSON payload.", "fields": ["variables"], "detail": "Can not deserialize instance of io.vavr.collection.Seq out of VALUE_STRING token\n at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 167] (through reference chain: com.atlassian.pipelines.rest.model.v1.pipeline.ImmutablePipelineModel$Builder[\"variables\"])", "data": {"key": "rest-service.request.invalid-json"}}}
Вернуться на верх