コード例 #1
0
ファイル: app.py プロジェクト: ErdnussFlipS/wpsnitch
    def post(self):
        self.response.headers['Content-Type'] = 'application/json'

        url = self.request.get('url')
        snitch = Snitch(url)

        try:
            snitch.get()
            output = self.render_str('fetch.html', data=snitch.data)
            self.json_write(output)
        except InvalidUrlException:
            self.json_write('This is not a valid URL it seems.')
        except InternalErrorException, e:
            self.json_write(e.message)
コード例 #2
0
def snitch(id):
    snitch_instance = Snitch(config[0], config[1], config[2], config[3])
    snitch_instance.move(id)
    return redirect(request.headers.get('Referer'))
コード例 #3
0
ファイル: main.py プロジェクト: careena/Quidditch
# 17.12.2020
# Quidditch v 8.0

from field import Field
from seeker import Seeker
from snitch import Snitch

# import the Pygame
import random, sys, copy, os, pygame
from pygame.locals import *

# create objects
field = Field()
s1 = Seeker('1', 4, 1)
s2 = Seeker('2', 5, 3)
sn = Snitch('@', 3, 2)

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FPS = 30                    # frames per second to update the screen
WINWIDTH = 800              # width and height of the program's window
WINHEIGHT = 600
HALF_WINWIDTH = int(WINWIDTH / 2)    # place things centrally
HALF_WINHEIGHT = int(WINHEIGHT / 2)

# The total width and height of each tile in pixels.
TILEWIDTH = 32
TILEHEIGHT = 32
TILEFLOORHEIGHT = 32

MEDIUMORCHID = (186,85,211)
DARKORCHID = (153,50,204)