Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

client for the threedi API

Project description

threedi-openapi-client

https://img.shields.io/pypi/v/threedi_openapi_client.svg https://img.shields.io/travis/larsclaussen/threedi_openapi_client.svg Documentation Status Updates

Features

  • OOP API interaction
  • async support

Getting started

get your auth tokens:

from openapi_client import ApiClient
from openapi_client import Configuration
from openapi_client import AuthApi
from openapi_client.models import TokenObtainPair

configuration = Configuration()
api_client = ApiClient(configuration)
auth = AuthApi(api_client)
tokens = auth.auth_token_create(
    TokenObtainPair(username, password)
)

configuration.api_key['Authorization'] = tokens.access
configuration.api_key_prefix['Authorization'] = 'Bearer'
# new client instance with auth headers
client = ApiClient(configuration)

Upload example (rain raster upload):

import requests
from openapi_client import SimulationsApi

simulation_pk = 1
filename = 'bergermeer_rasters_from_geotiffs.nc'
local_file_path = './data/bergermeer_rasters_from_geotiffs.nc'

# Use the api_client as created in the code block
# above
sim_api = SimulationsApi(api_client)

# Create rain raster upload resource in API
# returns a 'file_upload' instance containing a
# put_url property which is the URL to the object
# storage object to be uploaded with an HTTP PUT requests.
file_upload = sim_api.simulations_events_rain_rasters_upload(
    filename, simulation_pk)

# Open the local file in binary mode for uploading
with open(local_file_path, 'rb') as f:
    # Requests automatically streams the file this way
    requests.put(file_upload.put_url, data=f)

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.9 (2019-10-30)

  • Added resource statuses.

0.1.8 (2019-10-17)

  • Added timed control

0.1.7 (2019-09-25)

  • Laterals now have id field.
  • Usage integration

0.1.6 (2019-09-04)

  • Added geojson/gridadmin/rasters upload & download

0.1.5 (2019-07-03)

  • Updated file uploading

0.1.4 (2019-06-24)

  • Include modules.

0.1.3 (2019-06-24)

  • Fix package name

0.1.2 (2019-06-24)

  • PyPi release.

0.1.1 (2019-06-21)

  • Included more endpoints

0.1.0 (2019-05-10)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for threedi-openapi-client, version 0.1.9
Filename, size File type Python version Upload date Hashes
Filename, size threedi_openapi_client-0.1.9-py2.py3-none-any.whl (270.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size threedi_openapi_client-0.1.9.tar.gz (115.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page