How to use the pywws.constants.Twitter.consumer_secret function in pywws

To help you get started, we’ve selected a few pywws examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jim-easterbrook / pywws / src / pywws / totwitter.py View on Github external
def twitter_auth(params):
    import webbrowser
    if sys.version_info[0] >= 3:
        from urllib.parse import parse_qsl
    else:
        from urlparse import parse_qsl
    import oauth2 as oauth

    consumer = oauth.Consumer(pct.consumer_key, pct.consumer_secret)
    client = oauth.Client(consumer)
    # step 1 - obtain a request token
    resp, content = client.request(
        'https://api.twitter.com/oauth/request_token', 'POST')
    if resp['status'] != '200':
        print('Failed to get request token. [%s]' % resp['status'])
        return 1
    if isinstance(content, bytes):
        content = content.decode('utf-8')
    request_token = dict(parse_qsl(content))
    # step 2 - redirect the user
    redirect_url = 'https://api.twitter.com/oauth/authorize?oauth_token=%s' % (
        request_token['oauth_token'])
    if not webbrowser.open(redirect_url, new=2, autoraise=0):
        print('Please use a web browser to open the following URL')
        print(redirect_url)
github jim-easterbrook / pywws / src / pywws / totwitter.py View on Github external
def __init__(self, key, secret, latitude, longitude):
        logger.info('Using tweepy library')
        auth = tweepy.OAuthHandler(pct.consumer_key, pct.consumer_secret)
        auth.set_access_token(key, secret)
        self.api = tweepy.API(auth)
        if latitude is not None and longitude is not None:
            self.kwargs = {'lat' : latitude, 'long' : longitude}
        else:
            self.kwargs = {}
github jim-easterbrook / pywws / src / pywws / service / twitter.py View on Github external
def __init__(self, key, secret, latitude, longitude):
        logger.info('Using tweepy library')
        auth = tweepy.OAuthHandler(pct.consumer_key, pct.consumer_secret)
        auth.set_access_token(key, secret)
        self.api = tweepy.API(auth)
        if latitude is not None and longitude is not None:
            self.kwargs = {'lat' : latitude, 'long' : longitude}
        else:
            self.kwargs = {}
github jim-easterbrook / pywws / src / pywws / TwitterAuth.py View on Github external
def TwitterAuth(params):
    consumer = oauth.Consumer(Twitter.consumer_key, Twitter.consumer_secret)
    client = oauth.Client(consumer)
    # step 1 - obtain a request token
    resp, content = client.request(
        'https://api.twitter.com/oauth/request_token', 'POST')
    if resp['status'] != '200':
        print 'Failed to get request token. [%s]' % resp['status']
        return 1
    request_token = dict(urlparse.parse_qsl(content))
    # step 2 - redirect the user
    redirect_url = 'https://api.twitter.com/oauth/authorize?oauth_token=%s' % (
        request_token['oauth_token'])
    if not webbrowser.open(redirect_url, new=2, autoraise=0):
        print 'Please use a web browser to open the following URL'
        print redirect_url
    pin = raw_input('Please enter the PIN shown in your web browser: ').strip()
    # step 3 - convert the request token to an access token
github jim-easterbrook / pywws / src / pywws / service / twitter.py View on Github external
def register(self):
        import webbrowser
        if sys.version_info[0] >= 3:
            from urllib.parse import parse_qsl
        else:
            from urlparse import parse_qsl
        import oauth2 as oauth

        consumer = oauth.Consumer(pct.consumer_key, pct.consumer_secret)
        client = oauth.Client(consumer)
        # step 1 - obtain a request token
        resp, content = client.request(
            'https://api.twitter.com/oauth/request_token', 'POST')
        if resp['status'] != '200':
            print('Failed to get request token. [%s]' % resp['status'])
            return
        if isinstance(content, bytes):
            content = content.decode('utf-8')
        request_token = dict(parse_qsl(content))
        # step 2 - redirect the user
        redirect_url = 'https://api.twitter.com/oauth/authorize?oauth_token=%s' % (
            request_token['oauth_token'])
        if not webbrowser.open(redirect_url, new=2, autoraise=0):
            print('Please use a web browser to open the following URL')
            print(redirect_url)
github jim-easterbrook / pywws / src / pywws / service / twitter.py View on Github external
def __init__(self, key, secret, latitude, longitude, timeout):
        logger.info('Using python-twitter library')
        self.api = twitter.Api(
            consumer_key=pct.consumer_key,
            consumer_secret=pct.consumer_secret,
            access_token_key=key, access_token_secret=secret,
            timeout=timeout)
        if latitude is not None and longitude is not None:
            self.kwargs = {'latitude' : latitude, 'longitude' : longitude,
                           'display_coordinates' : True}
        else:
            self.kwargs = {}
        self.kwargs['verify_status_length'] = False
github jim-easterbrook / pywws / src / pywws / totwitter.py View on Github external
def __init__(self, key, secret, latitude, longitude, timeout):
        logger.info('Using python-twitter library')
        self.api = twitter.Api(
            consumer_key=pct.consumer_key,
            consumer_secret=pct.consumer_secret,
            access_token_key=key, access_token_secret=secret,
            timeout=timeout)
        if latitude is not None and longitude is not None:
            self.kwargs = {'latitude' : latitude, 'longitude' : longitude,
                           'display_coordinates' : True}
        else:
            self.kwargs = {}
        self.kwargs['verify_status_length'] = False