-
Notifications
You must be signed in to change notification settings - Fork 2
/
api.py
30 lines (27 loc) · 1023 Bytes
/
api.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import requests
from requests_oauthlib import OAuth1
from util.objectdict import ObjectView
from petsy.listings.api import Listings
from petsy.transactions.api import Transactions
from petsy.shops.api import Shops
from petsy.users.api import Users
BASE_URI = 'https://openapi.etsy.com/v2/'
# Class to hold credentials
class Credentials(object):
def __init__(self, consumer_key, consumer_secret, access_token, access_token_secret):
self.consumer_key = consumer_key
self.consumer_secret = consumer_secret
self.access_token = access_token
self.access_token_secret = access_token_secret
class Api(object):
def __init__(self, **kwargs):
creds = Credentials(
kwargs['consumer_key'],
kwargs['consumer_secret'],
kwargs['access_token'],
kwargs['access_token_secret']
)
self.listings = Listings(creds)
self.transactions = Transactions(creds)
self.shops = Shops(creds)
self.users = Users(creds)