<commit_before># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import collections
import datetime
import logging

import requests


LOG = logging.getLogger(__name__)


_url = 'https://getpocket.com/v3/get'
_headers = {
    'X-Accept': 'application/json',
}


PocketItem = collections.namedtuple(
    'PocketItem',
    ['url', 'title', 'excerpt', 'time_updated', 'tags']
)


def make_pocket_item(i):
    tags = i.get('tags', {}).keys()
    title = (i.get('resolved_title') or u'No title').encode('utf-8')
    time_updated = datetime.datetime.fromtimestamp(
        float(i['time_updated'])
    )
    excerpt = i.get('excerpt', u'').encode('utf-8')
    return PocketItem(
        url=i['given_url'],
        title=title,
        excerpt=excerpt,
        time_updated=time_updated,
        tags=tags,
    )


def get_items(consumer_key, access_token, since):
    payload = {
        'consumer_key': consumer_key,
        'access_token': access_token,<commit_msg>use resolved_url instead of given_url to cut down on need to fix redirects<commit_after># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import collections
import datetime
import logging

import requests


LOG = logging.getLogger(__name__)


_url = 'https://getpocket.com/v3/get'
_headers = {
    'X-Accept': 'application/json',
}


PocketItem = collections.namedtuple(
    'PocketItem',
    ['url', 'title', 'excerpt', 'time_updated', 'tags']
)


def make_pocket_item(i):
    tags = i.get('tags', {}).keys()
    title = (i.get('resolved_title') or u'No title').encode('utf-8')
    time_updated = datetime.datetime.fromtimestamp(
        float(i['time_updated'])
    )
    excerpt = i.get('excerpt', u'').encode('utf-8')
    return PocketItem(
        url=i['resolved_url'],
        title=title,
        excerpt=excerpt,
        time_updated=time_updated,
        tags=tags,
    )


def get_items(consumer_key, access_token, since):
    payload = {
        'consumer_key': consumer_key,
        'access_token': access_token,
{'fraction_non_alphanumeric': 0.11685695097380792, 'fraction_numerical': 0.0047011417058428475, 'mean_word_length': 3.6619718309859155, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, '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': '3367358', 'n_tokens_mistral': 911, 'n_tokens_neox': 879, 'n_words': 279}