<commit_before>import json
import pprint
import sys
import uuid

import requests

root = 'http://localhost:8001'

def call(url, method, data):
    method = getattr(requests, method)
    url = root + url
    print 'Calling url:', url
    print 'Data:'
    pprint.pprint(data)
    data = json.dumps(data)
    result = method(url, data=data,
                    headers={'content-type': 'application/json'})
    print 'Status code:', result.status_code
    if result.status_code not in (200, 201, 202, 204):
        print 'Error:', result.content
        sys.exit()
    print 'Data:'
    pprint.pprint(result.json)
    print
    return result.json

uid = str(uuid.uuid4())

print 'Creating for:', uid
print 'Creating seller.'
res = call('/generic/seller/', 'post', {'uuid': uid})
print res
seller_uri = res['resource_uri']

print 'Creating seller product.'
external_id = str(uuid.uuid4())
res = call('/generic/product/', 'post', {'seller': seller_uri,
                                         'external_id': external_id,
                                         'secret': 'n'})
seller_product_uri = res['resource_uri']

print 'Create bango package.'
res = call('/bango/package/', 'post', {
    'seller': seller_uri,
    'adminEmailAddress': '<EMAIL>',
    'supportEmailAddress': '<EMAIL>',
    'financeEmailAddress': '<EMAIL>',
    'paypalEmailAddress': '<EMAIL>',
    'vendorName': 'Some Company',
    'companyName': 'Some Company, LLC',
    'address1': '111 Somewhere',
    'addressCity': 'Pleasantville',
    'addressState': 'CA',<commit_msg>add unicode test, just to be sure (bug 825682)<commit_after># -*- coding: utf-8 -*-
import json
import pprint
import sys
import uuid

import requests

root = 'http://localhost:8001'

def call(url, method, data):
    method = getattr(requests, method)
    url = root + url
    print 'Calling url:', url
    print 'Data:'
    pprint.pprint(data)
    data = json.dumps(data)
    result = method(url, data=data,
                    headers={'content-type': 'application/json'})
    print 'Status code:', result.status_code
    if result.status_code not in (200, 201, 202, 204):
        print 'Error:', result.content
        sys.exit()
    print 'Data:'
    pprint.pprint(result.json)
    print
    return result.json

uid = str(uuid.uuid4())

print 'Creating for:', uid
print 'Creating seller.'
res = call('/generic/seller/', 'post', {'uuid': uid})
print res
seller_uri = res['resource_uri']

print 'Creating seller product.'
external_id = str(uuid.uuid4())
res = call('/generic/product/', 'post', {'seller': seller_uri,
                                         'external_id': external_id,
                                         'secret': 'n'})
seller_product_uri = res['resource_uri']

print 'Create bango package.'
res = call('/bango/package/', 'post', {
    'seller': seller_uri,
    'adminEmailAddress': '<EMAIL>',
    'supportEmailAddress': '<EMAIL>',
    'financeEmailAddress': '<EMAIL>',
    'paypalEmailAddress': '<EMAIL>',
    'vendorName': u'འབྲུག་ཡུལ།',
    'companyName': 'Some Company, LLC',
    'address1': '111 Somewhere',
    'addressCity': 'Pleasantville',
    'addressState': 'CA',
{'fraction_non_alphanumeric': 0.15636942675159235, 'fraction_numerical': 0.01624203821656051, 'mean_word_length': 3.026923076923077, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1965582', 'n_tokens_mistral': 1027, 'n_tokens_neox': 1005, 'n_words': 257}