我正在使用python jira客户端使用基本身份验证建立与jira的连接。
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package CircleJavier;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.scene.Group;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.scene.control.Label;
import java.util.Random;
import javafx.scene.paint.Paint;
import javafx.scene.transform.Scale;
import javafx.scene.shape.*;
/**
*
* @author javyc
*/
public class CircleJavier extends Application {
@Override
public void start(Stage primaryStage) {
// Circ circ1 = new Circ();
// Circ circ2 = new Circ();
// Circ circ3 = new Circ();
// Circ circ4 = new Circ();
// Circ circ5 = new Circ();
Circ[] circleArray = new Circ[50];
for (int i = 0 ; i < circleArray.length; i++){
Circ circle = new Circ();
circleArray[i] = circle;
boolean overlaps = false;
for (int j = 0; j<i; j++){
double center = circleArray[j].x;
double dx = center - circle.x;
double y = circleArray[j].y;
double dy = y - circle.y;
double radius = circleArray[j].rad;
double dist = Math.sqrt((dx * dx)+(dy *dy));
if (dist <= (circle.rad + radius)) {
circleArray[i].fill = Color.AQUAMARINE;
overlaps = true;
circleArray[j].fill = Color.CADETBLUE;
}
}
if (!overlaps){
circleArray[i].fill = Color.BLACK;
}
}
Group root = new Group();
root.getChildren().addAll(circleArray);
Scene Scene = new Scene(root, 500,350, Color.WHITE);
primaryStage.setTitle("Elephant Javier!");
primaryStage.setScene(Scene);
primaryStage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
此代码可以正常工作到昨天。
来自GET https://server.atlassian.net/rest/api/2/serverInfo的可恢复错误,将在17.5832343958s中重试1/3。错误:401
我的密码和电子邮件是正确的。我可以手动登录
答案 0 :(得分:2)
自2019年4月14日起,针对Jira和Confluence云的基于密码的基本身份验证和基于cookie的身份验证不再有效-参见deprecation notice。需要使用Api token代替basic_auth
的密码。
下面的代码段应该可以工作:
from jira.client import JIRA
api_token = "***********************"
jira = JIRA(options={'server': 'https://server.atlassian.net'},
basic_auth=('email@example.com', api_token))
我还在pycontrib/jira
中提出了一个问题来反映这一点:https://github.com/pycontribs/jira/issues/780。
吉拉的门票紧随其后:
答案 1 :(得分:0)
奇怪,可能是HTTP与HTTPS的安全设置。尝试传递给https而不是http。
从jira.client导入JIRA
jira = JIRA(options = {'server':'https://server.atlassian.net'}, basic_auth =('email@example.com','pass'))
答案 2 :(得分:0)
似乎不建议使用REST API的密码。也许这会进一步帮助您:Atlassian Authentication