<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
add-bookmark.py
~~~~~~~~~~~~~~~~~

This module is an example of how to harness the Readability API w/ oAuth.

This module expects the following environment variables to be set:

- READABILITY_CONSUMER_KEY
- READABILITY_CONSUMER_SECRET
- READABILITY_ACCESS_TOKEN
- READABILITY_ACCESS_SECRET

Once you have your consumer keys set up, run the following to get your OAuth
tokens:

    $ ./login-xauth.py <username> <password>

"""

import sys

from ext import readability
from ext import get_consumer_keys, get_access_token

readability.settings.base_url = 'http://1172.16.31.10:8000/api/rest/v1/%s'


def main():

    try:
        c_key, c_secret = get_consumer_keys()
    except ValueError:
        print >> sys.stderr, 'READABILITY_ACCESS_TOKEN and READABILITY_ACCESS_SECRET must be set.'
        sys.exit(1)

    token = get_access_token()

    rdd = readability.oauth(c_key, c_secret, token=token)

    url = raw_input('Enter a URL to bookmark: ')
    print url
    
    bookmark = rdd.add_bookmark(url=url)
    
    print bookmark


if __name__ == '__main__':
    main()<commit_msg>no dev url<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
add-bookmark.py
~~~~~~~~~~~~~~~~~

This module is an example of how to harness the Readability API w/ oAuth.

This module expects the following environment variables to be set:

- READABILITY_CONSUMER_KEY
- READABILITY_CONSUMER_SECRET
- READABILITY_ACCESS_TOKEN
- READABILITY_ACCESS_SECRET

Once you have your consumer keys set up, run the following to get your OAuth
tokens:

    $ ./login-xauth.py <username> <password>

"""

import sys

from ext import readability
from ext import get_consumer_keys, get_access_token


def main():

    try:
        c_key, c_secret = get_consumer_keys()
    except ValueError:
        print >> sys.stderr, 'READABILITY_ACCESS_TOKEN and READABILITY_ACCESS_SECRET must be set.'
        sys.exit(1)

    token = get_access_token()

    rdd = readability.oauth(c_key, c_secret, token=token)

    url = raw_input('Enter a URL to bookmark: ')
    print url

    bookmark = rdd.add_bookmark(url=url)

    print bookmark


if __name__ == '__main__':
    main()
{'fraction_non_alphanumeric': 0.10528694080433801, 'fraction_numerical': 0.00858563036601898, 'mean_word_length': 3.5933609958506225, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '84511', 'n_tokens_mistral': 751, 'n_tokens_neox': 722, 'n_words': 207}