Asana
Project description
narwhalyeti
This is the interface for interacting with the Asana Platform
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 1.0.0
- Package version: 0.0.3
- Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit https://asana.com/support
Requirements.
Python >=3.6
Installation & Usage
pip install
If the python package is hosted on a repository, you can install directly using:
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
(you may need to run pip
with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
)
Then import the package:
import narwhalyeti
Setuptools
Install via Setuptools.
python setup.py install --user
(or sudo python setup.py install
to install the package for all users)
Then import the package:
import narwhalyeti
Getting Started
Please follow the installation procedure and then run the following:
import time
import narwhalyeti
from pprint import pprint
from narwhalyeti.api import attachment_api
from narwhalyeti.model.attachment_response import AttachmentResponse
from narwhalyeti.model.error_response import ErrorResponse
# Defining the host is optional and defaults to https://app.asana.com/api/1.0
# See configuration.py for a list of all supported configuration parameters.
configuration = narwhalyeti.Configuration(
host = "https://app.asana.com/api/1.0"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure OAuth2 access token for authorization: oauth2
configuration = narwhalyeti.Configuration(
host = "https://app.asana.com/api/1.0"
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Configure Bearer authorization: personal_access_token
configuration = narwhalyeti.Configuration(
access_token = 'YOUR_BEARER_TOKEN'
)
# Enter a context with an instance of the API client
with narwhalyeti.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = attachment_api.AttachmentApi(api_client)
opt_fields = ["name","parent"] # [str] | Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options. (optional)
opt_pretty = True # bool | Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging. (optional)
resource_subtype = "external" # str | The type of the attachment. Must be one of the given values. If not specified, a file attachment of type `asana` will be assumed. Note that if the value of `resource_subtype` is `external`, a `parent`, `name`, and `url` must also be provided. (optional)
file = open('/path/to/file', 'rb') # file_type | Required for `asana` attachments. (optional)
parent = "12345" # str | Required identifier of the parent task, project, or project_brief, as a string. (optional)
url = "https://assets.asana.biz/m/7342a96f034ee491/original/trademark-logo-lockup-horizontal.png" # str | The URL of the external resource being attached. Required for attachments of type `external`. (optional)
name = "attachment_name" # str | The name of the external resource being attached. Required for attachments of type `external`. (optional)
connect_to_app = False # bool | *Optional*. Only relevant for external attachments with a parent task. A boolean indicating whether the current app should be connected with the attachment for the purposes of showing an app components widget. Requires the app to have been added to a project the parent task is in. (optional)
try:
# Upload an attachment
api_response = api_instance.create_attachment(opt_fields=opt_fields, opt_pretty=opt_pretty, resource_subtype=resource_subtype, file=file, parent=parent, url=url, name=name, connect_to_app=connect_to_app)
pprint(api_response)
except narwhalyeti.ApiException as e:
print("Exception when calling AttachmentApi->create_attachment: %s\n" % e)
Documentation for API Endpoints
All URIs are relative to https://app.asana.com/api/1.0
Class | Method | HTTP request | Description |
---|---|---|---|
AttachmentApi | create_attachment | POST /attachments | Upload an attachment |
Documentation For Models
- AttachmentResponse
- AttachmentResponseData
- AttachmentResponseDataParent
- ErrorResponse
- ErrorResponseErrorsInner
Documentation For Authorization
oauth2
- Type: OAuth
- Flow: accessCode
- Authorization URL: https://app.asana.com/-/oauth_authorize
- Scopes:
- default: Provides access to all endpoints documented in our API reference. If no scopes are requested, this scope is assumed by default.
- openid: Provides access to OpenID Connect ID tokens and the OpenID Connect user info endpoint.
- email: Provides access to the user’s email through the OpenID Connect user info endpoint.
- profile: Provides access to the user’s name and profile photo through the OpenID Connect user info endpoint.
personal_access_token
- Type: Bearer authentication
Author
Notes for Large OpenAPI documents
If the OpenAPI document is large, imports in narwhalyeti.apis and narwhalyeti.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:
Solution 1: Use specific imports for apis and models like:
from narwhalyeti.api.default_api import DefaultApi
from narwhalyeti.model.pet import Pet
Solution 2: Before importing the package, adjust the maximum recursion limit as shown below:
import sys
sys.setrecursionlimit(1500)
import narwhalyeti
from narwhalyeti.apis import *
from narwhalyeti.models import *
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for narwhalyeti-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58a38af2ba2462a61968c66c0f2bea8b7b3f87ec0310ed3d182dc2caa5690b2a |
|
MD5 | 167412ae27bdeec1f1b553b3873dbe28 |
|
BLAKE2b-256 | 0dc31fdfbe84b0bfca67de566aa37b99d3c797d97b57c63a128b619183185edb |