-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
473 additions
and
290 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"python.linting.enabled": true, | ||
"python.linting.pylintUseMinimalCheckers": false, | ||
"python.linting.pylintEnabled": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pylint | ||
build | ||
twine | ||
wheel | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
setuptools.setup( | ||
name="autodesk-forge-sdk", | ||
version="0.0.4", | ||
version="0.1.0", | ||
author="Petr Broz", | ||
author_email="[email protected]", | ||
description="Unofficial Autodesk Forge SDK for Python.", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
from .auth import AuthenticationClient, Scope, TokenProviderInterface, SimpleTokenProvider, OAuthTokenProvider | ||
""" | ||
Clients for communicating with different Autodesk Forge services. | ||
""" | ||
|
||
from .auth import AuthenticationClient, Scope, get_authorization_url | ||
from .auth import TokenProviderInterface, SimpleTokenProvider, OAuthTokenProvider | ||
from .oss import OSSClient | ||
from .md import ModelDerivativeClient, urnify | ||
from .md import ModelDerivativeClient, urnify |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,62 @@ | ||
""" | ||
Helper classes used by other API clients. | ||
""" | ||
|
||
import requests | ||
|
||
class BaseClient(object): | ||
|
||
class BaseClient: | ||
""" | ||
Base client for accessing web-based APIs. | ||
""" | ||
def __init__(self, base_url: str): | ||
self.base_url = base_url | ||
|
||
def _resolve_url(self, url: str) -> str: | ||
if url.startswith('/'): | ||
if url.startswith("/"): | ||
url = self.base_url + url | ||
return url | ||
|
||
def _get(self, url: str, params: dict=None, headers: dict=None) -> requests.Response: | ||
def _get(self, url: str, **kwargs) -> requests.Response: | ||
url = self._resolve_url(url) | ||
response = requests.get(url, params=params, headers=headers) | ||
response = requests.get(url, **kwargs) | ||
response.raise_for_status() | ||
return response | ||
|
||
def _post(self, url: str, form: dict=None, json: dict=None, buff=None, params: dict=None, headers: dict=None) -> requests.Response: | ||
def _post( | ||
self, url: str, form: dict = None, json: dict = None, buff=None, **kwargs | ||
) -> requests.Response: | ||
url = self._resolve_url(url) | ||
response = None | ||
if form: | ||
response = requests.post(url, data=form, params=params, headers=headers) | ||
response = requests.post(url, data=form, **kwargs) | ||
elif form: | ||
response = requests.post(url, data=buff, params=params, headers=headers) | ||
response = requests.post(url, data=buff, **kwargs) | ||
elif json: | ||
response = requests.post(url, json=json, params=params, headers=headers) | ||
response = requests.post(url, json=json, **kwargs) | ||
else: | ||
response = requests.post(url, params=params, headers=headers) | ||
response = requests.post(url, **kwargs) | ||
response.raise_for_status() | ||
return response | ||
|
||
def _put(self, url: str, form: dict=None, json: dict=None, buff=None, params: dict=None, headers: dict=None) -> requests.Response: | ||
def _put( | ||
self, url: str, form: dict = None, json: dict = None, buff=None, **kwargs | ||
) -> requests.Response: | ||
url = self._resolve_url(url) | ||
response = None | ||
if form: | ||
response = requests.put(url, data=form, params=params, headers=headers) | ||
response = requests.put(url, data=form, **kwargs) | ||
elif buff: | ||
response = requests.put(url, data=buff, params=params, headers=headers) | ||
response = requests.put(url, data=buff, **kwargs) | ||
elif json: | ||
response = requests.put(url, json=json, params=params, headers=headers) | ||
response = requests.put(url, json=json, **kwargs) | ||
else: | ||
response = requests.put(url, params=params, headers=headers) | ||
response = requests.put(url, **kwargs) | ||
response.raise_for_status() | ||
return response | ||
def _delete(self, url: str, params: dict=None, headers: dict=None) -> requests.Response: | ||
|
||
def _delete(self, url: str, **kwargs) -> requests.Response: | ||
url = self._resolve_url(url) | ||
response = requests.delete(url, params=params, headers=headers) | ||
response = requests.delete(url, **kwargs) | ||
response.raise_for_status() | ||
return response | ||
return response |
Oops, something went wrong.