Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update python sdk #120

Merged
merged 10 commits into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ $ git clone https://github.com/[YOUR_GITHUB_NAME]/data.world-py.git
$ cd data.world-py
$ git remote add upstream https://github.com/datadotworld/data.world-py.git
```

### Install and Test
#### Python Version Support
The following list of python versions have been tested and have been found to work with the SDK.
This is not a conclusive list and should be amended to include other versions that have worked for others:
- 3.5.9


Run the command below to install packages required:

Expand All @@ -38,7 +42,10 @@ $ git checkout master
$ git pull upstream master
$ git checkout -b my-feature-branch
```

### Running Swagger-codegen
Should you find the need to run swagger-codegen, you will need to make changes to some generated code in order to address an issue with OAuth.
You can refer to the issue for more details: https://github.com/swagger-api/swagger-codegen/issues/10968
After running swagger-codegen, you will need to update the `configurations.py` file by adding this [function](https://github.com/datadotworld/data.world-py/pull/120/files#diff-097089a848b0e5d38d7a980e2d1ffea3e687f544e286573cf79ef0297ba1e118R197-R202), and using it in the `auth_settings` function over [here](https://github.com/datadotworld/data.world-py/pull/120/files#diff-097089a848b0e5d38d7a980e2d1ffea3e687f544e286573cf79ef0297ba1e118R225).
### Write Tests

Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build. Add tests to spec.
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ test:
test-report:
coverage report -m
update_swagger_codegen:
mvn dependency:get -Dartifact=io.swagger:swagger-codegen-cli:2.2.3:jar -DremoteRepositories=central::default::https://repo.maven.apache.org/maven2
pushd datadotworld/client; \
curl https://api.data.world/v0/swagger.json -o swagger-dwapi-def.json; \
swagger-codegen generate -l python --git-repo-id=data.world-py --git-user-id=datadotworld \
curl https://raw.githubusercontent.com/datadotworld/dwapi-spec/master/src/main/resources/world/data/api/swagger.json -o swagger-dwapi-def.json; \
java -jar ~/.m2/repository/io/swagger/swagger-codegen-cli/2.2.3/swagger-codegen-cli-2.2.3.jar generate -l python --git-repo-id=data.world-py --git-user-id=datadotworld \
--http-user-agent="data.world-py" --invoker-package=client \
-i swagger-dwapi-def.json -c swagger-codegen-config.json --release-note=""; \
popd;
popd;
5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ The client currently implements the following functions:
* ``replace_insight``
* ``update_insight``
* ``delete_insight``
* ``search_resources``

For a few examples of what the ``ApiClient`` can be used for, see below.

Expand All @@ -338,7 +339,7 @@ For example:

.. code-block:: python

>>> client = dw.api_client
>>> client = dw.api_client()
>>> client.add_files_via_url('username/test-dataset', files={'sample.xls': {'url':'http://www.sample.com/sample.xls', 'description': 'sample doc', 'labels': ['raw data']}})

Append records to stream
Expand All @@ -350,7 +351,7 @@ For example:

.. code-block:: python

>>> client = dw.api_client
>>> client = dw.api_client()
>>> client.append_records('username/test-dataset','streamId', {'data': 'data'})

Contents of a stream will appear as part of the respective dataset as a .jsonl file.
Expand Down
2 changes: 1 addition & 1 deletion datadotworld/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
)
from datadotworld.datadotworld import DataDotWorld, UriParam # noqa: F401

__version__ = '1.7.0'
__version__ = '1.8.0'

# Convenience top-level functions

Expand Down
91 changes: 85 additions & 6 deletions datadotworld/client/_swagger/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"""
data.world API

data.world is designed for data and the people who work with data. From professional projects to open data, data.world helps you host and share your data, collaborate with your team, and capture context and conclusions as you work. Using this API users are able to easily access data and manage their data projects regardless of language or tool of preference. Check out our [documentation](https://dwapi.apidocs.io) for tips on how to get started, tutorials and to interact with the API right within your browser.
# data.world in a nutshell data.world is a productive, secure platform for modern data teamwork. We bring together your data practitioners, subject matter experts, and other stakeholders by removing costly barriers to data discovery, comprehension, integration, and sharing. Everything your team needs to quickly understand and use data stays with it. Social features and integrations encourage collaborators to ask and answer questions, share discoveries, and coordinate closely while still using their preferred tools. Our focus on interoperability helps you enhance your own data with data from any source, including our vast and growing library of free public datasets. Sophisticated permissions, auditing features, and more make it easy to manage who views your data and what they do with it. # Conventions ## Authentication All data.world API calls require an API token. OAuth2 is the preferred and most secure method for authenticating users of your data.world applications. Visit our [oauth documentation](https://apidocs.data.world/toolkit/oauth) for additional information. Alternatively, you can obtain a token for _personal use or testing_ by navigating to your profile settings, under the Advanced tab ([https://data.world/settings/advanced](https://data.world/settings/advanced)). Authentication must be provided in API requests via the `Authorization` header. For example, for a user whose API token is `my_api_token`, the request header should be `Authorization: Bearer my_api_token` (note the `Bearer` prefix). ## Content type By default, `application/json` is the content type used in request and response bodies. Exceptions are noted in respective endpoint documentation. ## HTTPS only Our APIs can only be accessed via HTTPS. # Interested in building data.world apps? Check out our [developer portal](https://apidocs.data.world) for tips on how to get started, tutorials, and to interact with the API endpoints right within your browser.

OpenAPI spec version: 0.14.1
OpenAPI spec version: 0.21.0
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
Expand All @@ -14,13 +14,41 @@
from __future__ import absolute_import

# import models into sdk package
from .models.agent_hydration_dto import AgentHydrationDto
from .models.analysis_image import AnalysisImage
from .models.asset_status import AssetStatus
from .models.catalog_analysis_hydration_dto import CatalogAnalysisHydrationDto
from .models.catalog_analysis_request import CatalogAnalysisRequest
from .models.catalog_business_term_hydration_dto import CatalogBusinessTermHydrationDto
from .models.catalog_column_hydration_dto import CatalogColumnHydrationDto
from .models.catalog_column_request import CatalogColumnRequest
from .models.catalog_concept_hydration_dto import CatalogConceptHydrationDto
from .models.catalog_glossary_request import CatalogGlossaryRequest
from .models.catalog_hydration_dto import CatalogHydrationDto
from .models.catalog_id import CatalogId
from .models.catalog_request import CatalogRequest
from .models.catalog_table_hydration_dto import CatalogTableHydrationDto
from .models.catalog_table_request import CatalogTableRequest
from .models.concept_entry import ConceptEntry
from .models.connection_dto import ConnectionDto
from .models.create_dataset_response import CreateDatasetResponse
from .models.create_insight_response import CreateInsightResponse
from .models.create_project_response import CreateProjectResponse
from .models.create_query_request import CreateQueryRequest
from .models.create_response import CreateResponse
from .models.custom_dataset_or_project_metadata_request import CustomDatasetOrProjectMetadataRequest
from .models.database_credentials import DatabaseCredentials
from .models.database_dbo import DatabaseDbo
from .models.database_source_reference import DatabaseSourceReference
from .models.dataset_create_request import DatasetCreateRequest
from .models.dataset_hydration_dto import DatasetHydrationDto
from .models.dataset_identifier import DatasetIdentifier
from .models.dataset_patch_request import DatasetPatchRequest
from .models.dataset_put_request import DatasetPutRequest
from .models.dataset_summary_response import DatasetSummaryResponse
from .models.doi import Doi
from .models.edit_activities_result_dto import EditActivitiesResultDto
from .models.entry_type import EntryType
from .models.error_message import ErrorMessage
from .models.file_batch_update_request import FileBatchUpdateRequest
from .models.file_create_or_update_request import FileCreateOrUpdateRequest
Expand All @@ -31,33 +59,84 @@
from .models.file_summary_response import FileSummaryResponse
from .models.insight_body import InsightBody
from .models.insight_create_request import InsightCreateRequest
from .models.insight_hydration_dto import InsightHydrationDto
from .models.insight_patch_request import InsightPatchRequest
from .models.insight_put_request import InsightPutRequest
from .models.insight_summary_response import InsightSummaryResponse
from .models.instant import Instant
from .models.json_node import JsonNode
from .models.linked_dataset_create_or_update_request import LinkedDatasetCreateOrUpdateRequest
from .models.linked_dataset_summary_response import LinkedDatasetSummaryResponse
from .models.metadata_resource_dto import MetadataResourceDto
from .models.oauth_token_reference import OauthTokenReference
from .models.paginated_connection_results import PaginatedConnectionResults
from .models.paginated_dataset_results import PaginatedDatasetResults
from .models.paginated_insight_results import PaginatedInsightResults
from .models.paginated_metadata_resource_results import PaginatedMetadataResourceResults
from .models.paginated_project_results import PaginatedProjectResults
from .models.paginated_query_results import PaginatedQueryResults
from .models.paginated_search_results_dto import PaginatedSearchResultsDto
from .models.paginated_subscription_results import PaginatedSubscriptionResults
from .models.project_create_request import ProjectCreateRequest
from .models.project_patch_request import ProjectPatchRequest
from .models.project_put_request import ProjectPutRequest
from .models.project_summary_response import ProjectSummaryResponse
from .models.query_parameter import QueryParameter
from .models.query_put_request import QueryPutRequest
from .models.query_summary_response import QuerySummaryResponse
from .models.range import Range
from .models.rdf_term import RdfTerm
from .models.relationship_create_or_delete_request import RelationshipCreateOrDeleteRequest
from .models.relationship_get_request import RelationshipGetRequest
from .models.relationship_get_table_request import RelationshipGetTableRequest
from .models.resource_relationship_dto import ResourceRelationshipDto
from .models.saved_query_execution_request import SavedQueryExecutionRequest
from .models.search_facet_result import SearchFacetResult
from .models.search_hydrations import SearchHydrations
from .models.search_request import SearchRequest
from .models.simple_search_request import SimpleSearchRequest
from .models.single_table_metadata_spec import SingleTableMetadataSpec
from .models.source_id import SourceId
from .models.sql_query_request import SqlQueryRequest
from .models.ssh_tunnel import SshTunnel
from .models.stream_schema import StreamSchema
from .models.stream_schema_patch_request import StreamSchemaPatchRequest
from .models.streams_resource import StreamsResource
from .models.subscription import Subscription
from .models.subscription_api_links import SubscriptionApiLinks
from .models.subscription_create_request import SubscriptionCreateRequest
from .models.subscription_links import SubscriptionLinks
from .models.success_message import SuccessMessage
from .models.table_batch_update_request import TableBatchUpdateRequest
from .models.table_create_or_update_request import TableCreateOrUpdateRequest
from .models.table_id import TableId
from .models.table_source_create_or_update_request import TableSourceCreateOrUpdateRequest
from .models.tag import Tag
from .models.user_data_response import UserDataResponse
from .models.user_identifier import UserIdentifier
from .models.web_authorization import WebAuthorization
from .models.web_credentials import WebCredentials

# import apis into sdk package
from .apis.connections_api import ConnectionsApi
from .apis.do_is_api import DOIsApi
from .apis.datasets_api import DatasetsApi
from .apis.download_api import DownloadApi
from .apis.files_api import FilesApi
from .apis.insights_api import InsightsApi
from .apis.metadataanalysis_api import MetadataanalysisApi
from .apis.metadatacollections_api import MetadatacollectionsApi
from .apis.metadatadata_api import MetadatadataApi
from .apis.metadataglossary_api import MetadataglossaryApi
from .apis.metadataproperties_api import MetadatapropertiesApi
from .apis.metadatarelationships_api import MetadatarelationshipsApi
from .apis.projects_api import ProjectsApi
from .apis.sparql_api import SparqlApi
from .apis.sql_api import SqlApi
from .apis.queries_api import QueriesApi
from .apis.search_api import SearchApi
from .apis.streams_api import StreamsApi
from .apis.uploads_api import UploadsApi
from .apis.tables_api import TablesApi
from .apis.user_api import UserApi
from .apis.users_api import UsersApi
from .apis.webhooks_api import WebhooksApi

# import ApiClient
from .api_client import ApiClient
Expand Down
4 changes: 2 additions & 2 deletions datadotworld/client/_swagger/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"""
data.world API

data.world is designed for data and the people who work with data. From professional projects to open data, data.world helps you host and share your data, collaborate with your team, and capture context and conclusions as you work. Using this API users are able to easily access data and manage their data projects regardless of language or tool of preference. Check out our [documentation](https://dwapi.apidocs.io) for tips on how to get started, tutorials and to interact with the API right within your browser.
# data.world in a nutshell data.world is a productive, secure platform for modern data teamwork. We bring together your data practitioners, subject matter experts, and other stakeholders by removing costly barriers to data discovery, comprehension, integration, and sharing. Everything your team needs to quickly understand and use data stays with it. Social features and integrations encourage collaborators to ask and answer questions, share discoveries, and coordinate closely while still using their preferred tools. Our focus on interoperability helps you enhance your own data with data from any source, including our vast and growing library of free public datasets. Sophisticated permissions, auditing features, and more make it easy to manage who views your data and what they do with it. # Conventions ## Authentication All data.world API calls require an API token. OAuth2 is the preferred and most secure method for authenticating users of your data.world applications. Visit our [oauth documentation](https://apidocs.data.world/toolkit/oauth) for additional information. Alternatively, you can obtain a token for _personal use or testing_ by navigating to your profile settings, under the Advanced tab ([https://data.world/settings/advanced](https://data.world/settings/advanced)). Authentication must be provided in API requests via the `Authorization` header. For example, for a user whose API token is `my_api_token`, the request header should be `Authorization: Bearer my_api_token` (note the `Bearer` prefix). ## Content type By default, `application/json` is the content type used in request and response bodies. Exceptions are noted in respective endpoint documentation. ## HTTPS only Our APIs can only be accessed via HTTPS. # Interested in building data.world apps? Check out our [developer portal](https://apidocs.data.world) for tips on how to get started, tutorials, and to interact with the API endpoints right within your browser.

OpenAPI spec version: 0.14.1
OpenAPI spec version: 0.21.0
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
Expand Down
18 changes: 14 additions & 4 deletions datadotworld/client/_swagger/apis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
from __future__ import absolute_import

# import apis into api package
from .connections_api import ConnectionsApi
from .do_is_api import DOIsApi
from .datasets_api import DatasetsApi
from .download_api import DownloadApi
from .files_api import FilesApi
from .insights_api import InsightsApi
from .metadataanalysis_api import MetadataanalysisApi
from .metadatacollections_api import MetadatacollectionsApi
from .metadatadata_api import MetadatadataApi
from .metadataglossary_api import MetadataglossaryApi
from .metadataproperties_api import MetadatapropertiesApi
from .metadatarelationships_api import MetadatarelationshipsApi
from .projects_api import ProjectsApi
from .sparql_api import SparqlApi
from .sql_api import SqlApi
from .queries_api import QueriesApi
from .search_api import SearchApi
from .streams_api import StreamsApi
from .uploads_api import UploadsApi
from .tables_api import TablesApi
from .user_api import UserApi
from .users_api import UsersApi
from .webhooks_api import WebhooksApi
Loading