Skip to content

Commit 988d9e4

Browse files
committed
implement initial functionality
1 parent 7050d13 commit 988d9e4

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

hypernode_api_python/client.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from requests import Session
2+
3+
HYPERNODE_API_URL = 'https://api.hypernode.com'
4+
5+
6+
class HypernodeAPIPython:
7+
def __init__(self, token, api_url=None):
8+
self.session = Session()
9+
self.token = token
10+
self.api_url = api_url if api_url else HYPERNODE_API_URL
11+
self.authorization_header = 'Token {}'.format(self.token)
12+
13+
def requests(self, method, path, *args, **kwargs):
14+
kwargs.setdefault('headers', {}).update({
15+
'Accept': 'application/json',
16+
'Authorization': self.authorization_header,
17+
'Accept-Language': 'en-US'
18+
})
19+
return session.request(method, HYPERNODE_API_URL.rstrip('/') + path, *args, **kwargs)
20+
21+
def get_app_flavor(self, app_name):
22+
return self.requests('GET', HYPERNODE_API_APP_FLAVOR_ENDPOINT.format(app_name))

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ def readfile(filename):
1313
name='hypernode_api_python',
1414
version='0.0.1',
1515
description='"Hypernode API Client for Python"',
16-
long_description=readfile('README.rst'),
17-
long_description_content_type='text/x-rst',
16+
long_description=readfile('README.md'),
17+
long_description_content_type='text/markdown',
1818
author='Hypernode',
1919
author_email='support@hypernode.com',
2020
license='MIT',

0 commit comments

Comments
 (0)