It's nice to let the rpm library do the dirty work of parsing a spec file, but the Python library doesn't allow extracting information from the resulting headers. The attached patch remedies this with two new spec object methods: sourceHeader and packageHeaders.
These methods return most of the same information you'd get by building the package and reading the headers from the source rpm (sourceHeader) or binary rpms (packageHeaders).
That's most, not all, because rpmbuild adds certain information to the headers when building a package, such as Provides for any .so files in a binary rpm. But for many applications, all the information you need is right there in the spec file, and these new methods give you a convenient way to access it from Python. For example:
import rpm
s = rpm.ts().parseSpec("foo.spec")
print s.sourceHeader()["name"]
print s.packageHeaders()[0]["name"]