我的代码在localhost入门工具包上按预期工作,但是当我将其部署到开发服务器时,我的以下代码大约需要2-3分钟,然后显示
import pygame
white = (255, 255, 255)
black = (0, 0, 0)
class Piece(pygame.sprite.Sprite):
def __init__(self, colour, x, y):
super().__init__()
self.colour = colour
self.x = x
self.y = y
def set_up_pieces(piece_list):
s = Piece(white, 4, 4)
piece_list.add(s)
s = Piece(black, 5, 4)
piece_list.add(s)
s = Piece(white, 5, 5)
piece_list.add(s)
s = Piece(black, 4, 5)
piece_list.add(s)
return piece_list
def flip_piece(piece_list, move, i, flip, player):
for p in piece_list:
if p.x == move[0] + (i + 1) * flip[0] and p.y == move[1] + (i + 1) * flip[1]:
new_piece = Piece(player, p.x, p.y)
piece_list.add(new_piece)
piece_list.remove(p)
return
def main():
piece_list = pygame.sprite.Group()
piece_list = set_up_pieces(piece_list)
player_to_move = white
# this simulates a move
move = [5, 3]
new_piece = Piece(player_to_move, move[0], move[1])
piece_list.add(new_piece)
flip = [-1, 0, 2]
for i in range(flip[2]):
flip_piece(piece_list, move, i, flip, player_to_move)
main()
我的代码如下:
Invalid URL
The requested URL "http://%5bNo%20Host%5d/index.html?", is invalid.
Reference #9.3d7c4117.1550338465.3d54af04
这是开发服务器上的AEM不允许访问的外部URL吗? 这是AEM 6.3,此代码在一个JSP中调用,而另一个JSP使用AJAX GET请求调用了此代码。
编辑(在Sumanta Pakira响应之后):仅当传递的URL是安全的(即HTTPS)时才会发生这种情况,对于HTTP URL,它按预期运行。