Python example of Twitter API 1.1 Application-Only Authentication, as specified at
You'll need to fill in your CONSUMER_KEY and CONSUMER_SECRET
Generates a bearer token you can use for application-only authentication in your twitter apps, and issues a sample request using the token.