Query grease pencil strokes from python
Grease Pencil data is stored globally in bpy.data.grease_pencil. Scenes and objects can reference a Grease Pencil datablock.

Up to Blender 2.72, the active object was used. With no active object (right after object deletion), the active scene was used instead. From 2.73 on, the active scene is chosen all the time. There's legacy support for the object level however. For future use, you should assume the GPencil data to be associated with the active scene:

gp = bpy.context.scene.grease_pencil


The GPencil data is hierarchically organized in layers, frames, strokes and points:

# Get 1st point of 1st stroke on active frame and layer
point = gp.layers.active.active_frame.strokes[0].points[0]

point.co       # 3D Vector location
point.pressure # tablet pressure (1.0 on mouse input)
point.select   # selection state (bool)

layer = gp.layers[0] # first layer (by index)
layer = gp.layers["GP_Layer"] # by name
layer.color # color (fill_color for fill color)
layer.alpha # opacity (fill_alpha for fill opacity)

frame = layer.frames[1] # 2nd frame
frame.frame_number # frame number of that frame object

stroke = frame.strokes[-1] # last stroke
stroke.draw_mode # e.g. '3DSPACE'


You can create new GPencil data from scratch too:

gp = bpy.data.grease_pencil.new("My GPencil")
scene = bpy.context.scene
scene.grease_pencil = gp
scene.frame_set(5) # ensure we'll see the stroke (set to frame 5 below)

layer = gp.layers.new("Name for new layer", set_active=True)
layer.info # note: it's not layer.name!
layer.color = (1, 0.3, 0)

frame = layer.frames.new(5) # frame number 5
stroke = frame.strokes.new()
stroke.draw_mode = '3DSPACE' # either of ('SCREEN', '3DSPACE', '2DSPACE', '2DIMAGE')

stroke.points.add(4) # add 4 points
#stroke.points[0].co = (..., ..., ...) # set 1st point's location
stroke.points.foreach_set("co", (0,0,0,0,0,4,0,6,4,8,6,4)) # set all at once efficiently