Skype面试API自动计划无法正常工作

时间:2019-04-08 06:12:20

标签: python skype skypedeveloper

我正在尝试使用python和JWT集成Skype采访API。

第一次,我使用python和jwt创建一个令牌,然后,我将上面生成的令牌发送到Skype采访的API请求调用。

请求已处理,我得到了适当的答复。计划被设置为自动,日期建议被设置为候选。

我的问题不是候选人获得提议电子邮件的日期,而是面试官获得选择电子邮件的日期,甚至没有由候选人提议日期。

您可以在我的代码下方查看/检查:


  input_data = {

  "iemail": "interviewer@email.com",

  "iduration": 90,

  "cname": "Candidate",

  "location": "LOCAL"

  "position": "Full Stack Developer",

  "cemail": "candidate@email.com",

  "iname": "Interviewer"

}

def payloadGenertor(content):

  jti = uuid.uuid1()

iss = "ISSUER"

iat = int(datetime.now().timestamp())

sub = hash256(content)

exp = iat + 10

payload = {

  "jti": f '{jti}',

  "iss": f '{iss}',

  "iat": iat,

  "sub": f '{sub}',

  "exp": exp

}

payloadStr = json.dumps(payload)

return payloadStr

url = "https://interviews.skype.com/api/interviews"

content = {

  "position": {

    "code": input_data['location'] + " " + str(uuid.uuid1()).split('-')[0],

    "title": input_data['position'],

    "Description": f "Interviews for {input_data['position']} {input_data['location']}."

  },

  "participants": [

    {

      "name": input_data['iname'],

      "email": input_data['iemail'],

      "role": "interviewer",

      "timezone": "Asia/Kolkata"

    },

    {

      "name": input_data['cname'],

      "email": input_data['cemail'],

      "role": "candidate",

      "timezone": "Asia/Kolkata"

    }

  ],

  "scheduling": {

    "duration": int(input_data['iduration']),

    "mode": "automatic",

    "dateproposing": "candidate"

  }

}

secret = "API_SECRET"

payloadHeader = {

  "alg": "HS256",

  "typ": "JWT"

}

payload = payloadGenertor(content)

jwt = generate_JWT(payloadHeader, payload, secret)

headers = {

  'Content-Type': 'application/json',

  'Authorization': 'Bearer ' + jwt

}

response = requests.post(url, data = content, headers = headers)

print(response.text)

0 个答案:

没有答案