Skip to content

Instantly share code, notes, and snippets.

View umith's full-sized avatar

Umith Indula Wimalarathna umith

View GitHub Profile
@umith
umith / get-bearer-token-twitter-api
Created November 19, 2020 22:24 — forked from valeriocos/get-bearer-token-twitter-api
Get a bearer token for Twitter application-only requests in Python3
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2018 Bitergia
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
@umith
umith / get-bearer-token-twitter-api
Created November 19, 2020 22:24 — forked from valeriocos/get-bearer-token-twitter-api
Get a bearer token for Twitter application-only requests in Python3
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2018 Bitergia
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
@umith
umith / gist:1d2b8830f7fc5bdf15503540ccbf09b7
Created November 19, 2020 22:18 — forked from iamdtang/gist:be8b4cc9558b3b6ab6cbef23150debe2
get bearer token from Twitter REST API for application-only authentication
require('dotenv').config();
const request = require('request');
const credentials = `${process.env.CONSUMER_KEY}:${process.env.CONSUMER_SECRET}`;
const credentialsBase64Encoded = new Buffer(credentials).toString('base64');
request({
url: 'https://api.twitter.com/oauth2/token',
method:'POST',
headers: {