<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>
-
URL
<The URL Structure (path only, no root url)>
-
Method:
from __future__ import division | |
import sys, pygame, time | |
import numpy as N | |
import pygame.surfarray as surfarray | |
pygame.init() | |
size = width, height = 1024,768 | |
xlength,xoffset = 3.5, -2.5 |
Asynchronous programming can be tricky for beginners, therefore I think it's useful to iron some basic concepts to avoid common pitfalls.
For an explanation about generic asynchronous programming, I recommend you one of the [many][2] [resources][3] [online][4].
I will focus on solely on asynchronous programming in [Tornado][1]. From Tornado's homepage:
import tornado.gen | |
class Library(): | |
@tornado.gen.engine | |
def ask(self, question, callback=None): | |
# do a computation that doesn't block for a long time. | |
result = "Why would you want to know about '{0}'".format(question) | |
error = None |
"""Demo of streaming requests with Tornado. | |
This script features a client using AsyncHTTPClient's body_producer | |
feature to slowly produce a large request body, and two server | |
handlers to receive this body (one is a proxy that forwards to the | |
other, also using body_producer). | |
It also demonstrates flow control: if --client_delay is smaller than | |
--server_delay, the client will eventually be suspended to allow the | |
server to catch up. You can see this in the logs, as the "client |
#!/usr/bin/env python | |
""" | |
Starts a Tornado static file server in a given directory. | |
To start the server in the current directory: | |
tserv . | |
Then go to http://localhost:8000 to browse the directory. | |
Use the --prefix option to add a prefix to the served URL, |
CloudFlare is an awesome reverse cache proxy and CDN that provides DNS, free HTTPS (TLS) support, best-in-class performance settings (gzip, SDCH, HTTP/2, sane Cache-Control
and E-Tag
headers, etc.), minification, etc.