コード例 #1
0
 def test_getting_forums_as_unsigned_client(self):
     client = uservoice.Client(
         self.config['subdomain_name'],
         self.config['api_key'],
         protocol=self.config.get('protocol'),
         uservoice_domain=self.config.get('uservoice_domain'))
     forums = client.get_collection('/api/v1/forums', limit=1)
     self.assertEqual(len(forums), 1)
コード例 #2
0
ファイル: client.py プロジェクト: maximilien/skills-tickets
 def get_client(self):
     if self.client == None:
         self.client = uservoice.Client(
             self.credentials.subdomain(),
             self.credentials.api_key(),
             self.credentials.api_secret(),
             callback=self.credentials.url_callback())
     return self.client
コード例 #3
0
 def test_getting_first_non_private_forum_as_unsigned_client(self):
     client = uservoice.Client(
         self.config['subdomain_name'],
         self.config['api_key'],
         protocol=self.config.get('protocol'),
         uservoice_domain=self.config.get('uservoice_domain'))
     first_forum = client.get_collection('/api/v1/forums', limit=1)[0]
     self.assertFalse(first_forum['private'])
コード例 #4
0
 def setUp(self):
     super(TestClient, self).setUp()
     with open('test/config.yml') as f:
         self.config = yaml.load(f)
     self.client = uservoice.Client(
         self.config['subdomain_name'],
         self.config['api_key'],
         self.config['api_secret'],
         protocol=self.config.get('protocol'),
         uservoice_domain=self.config.get('uservoice_domain'))
コード例 #5
0
    def test_login_with_access_token(self):
        old_client = self.client.login_as('*****@*****.**')

        new_client = uservoice.Client(
            self.config['subdomain_name'],
            self.config['api_key'],
            self.config['api_secret'],
            protocol=self.config.get('protocol'),
            uservoice_domain=self.config.get('uservoice_domain'))
        reloaded_token = new_client.login_with_access_token(
            old_client.token, old_client.secret)

        user = reloaded_token.get("/api/v1/users/current.json")['user']
        self.assertFalse(user['roles']['owner'])
        self.assertEqual(user['email'], '*****@*****.**')
コード例 #6
0
ファイル: main.py プロジェクト: melalj/uservoice-to-freshdesk
def download_uv_tickets(uv_ticket_outfile, total_records):
    '''thanks https://github.com/drmarshall/zendesk_migration'''
    uv_client = uservoice.Client(UV_SUBDOMAIN, UV_API_KEY, UV_API_SECRET)
    base_url = "/api/v1/tickets.json?"
    total_records = total_records

    tickets = {}
    page = 1
    print("Downloading page %s" % str(page))
    with open(uv_ticket_outfile, "w") as f:
        while total_records > page * 100:
            request = base_url + "page=" + str(
                page) + "&per_page=100" + "&type=Support+Request&state=closed"
            response = uv_client.get(request)
            f.write(json.dumps(response['tickets']) + "\n")
            print(json.dumps(response['response_data']))
            page = response['response_data']['page'] + 1
            total_records = response['response_data']['total_records']
            print("Downloading page %s of %s pages" %
                  (str(page), str(total_records / 100)))
コード例 #7
0
    def __init__(self):
        # get UV articles and topics to import
        uservoice_client = uservoice.Client(sys.argv[1], sys.argv[2],
                                            sys.argv[3])
        self.uv_user = uservoice_client.login_as_owner().get(
            '/api/v1/users/current')
        self.articles = uservoice_client.get_collection('/api/v1/articles')
        self.topics = uservoice_client.get_collection('/api/v1/topics')

        # setup zendesk client
        self.zendesk_url = 'https://%s.zendesk.com' % sys.argv[4]
        self.credentials = sys.argv[5] + '/token', sys.argv[6]
        self.language = 'en-us'
        self.headers = {'Content-Type': 'application/json'}
        self.zendesk_destination_category_id = self.get_or_create_category(
            sys.argv[7])

        # map new articles to old ones,
        # so we can rewrite the HTML of the articles in a second pass
        self.uvid_to_zdid = {}

        # keep track of sections we create in zendesk, to minimize the number of API requests
        self.local_sections = {}
コード例 #8
0
def uservoice_client():
    subdomain_name = 'serverauditor'
    api_key = 'kFrl5U0ECy6vK7nL4AJQ'
    api_secret = 'xEb2AG8A84jbeCZBUiBoEQLmSSGzS9AbeTXWRXeCjE'
    return uservoice.Client(subdomain_name, api_key, api_secret)
コード例 #9
0
ファイル: __init__.py プロジェクト: vsoch/helpme
    def authenticate(self):
        """authenticate with uservoice by creating a client."""

        if not hasattr(self, "client"):
            self.client = uservoice.Client(self.subdomain, self.api_key,
                                           self.api_secret)
コード例 #10
0
ファイル: migrate.py プロジェクト: mahilleb-msft/tools
USERVOICE_API_SECRET = ''
USERVOICE_SSO_KEY = ''
USERVOICE_CALLBACK_URL = 'http://docs.microsoft.com/'

GITHUB_TARGET_REPO = 'MicrosoftDocs/feedback'
GITHUB_PERSONAL_ACCESS_TOKEN = ''

f = ProfanitiesFilter([''], replacements="*")
f.inside_words = True

# GitHub Client
g = Github(GITHUB_PERSONAL_ACCESS_TOKEN)

# UserVoice Client
client = uservoice.Client(USERVOICE_ACCOUNT_ID,
                          USERVOICE_API_KEY,
                          USERVOICE_API_SECRET,
                          callback=USERVOICE_CALLBACK_URL)

suggestions = client.get_collection("/api/v1/suggestions?sort=newest")

# Loads the first page (at most 100 records) of suggestions and reads the count.
print("Total suggestions: " + str(len(suggestions)))

ideas_to_migrate = []

print('Collecting suggestions...')

# Loop through suggestions and figure out which ones need to be migrated.
for suggestion in suggestions:
    if suggestion['status']:
        status_type = suggestion['status']['name']