Skip to content

Python library for link shortening with URLR API.

Notifications You must be signed in to change notification settings

URLR/urlr-python

Repository files navigation

PyPI - Version PyPI - Downloads PyPI - License

This SDK is automatically generated with the OpenAPI Generator project.

  • API version: 1.3
  • Package version: 2.3.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

For more information, please visit https://urlr.me/en

Installation & Usage

Requirements

Python 3.7+

pip install

pip install urlr

Then import the package:

import urlr

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 urlr

Tests

Execute pytest to run the tests.

Getting Started

Please follow the installation procedure and then run the following:

import urlr
from urlr.rest import ApiException
from pprint import pprint

# Access Tokens

with urlr.ApiClient() as api_client:
    access_tokens_api = urlr.AccessTokensApi(api_client)
    
    access_tokens_request = urlr.AccessTokensRequest.from_json('{"username": "","password": ""}')

    try:
        api_response = access_tokens_api.create_access_token(access_tokens_request=access_tokens_request)
    except ApiException as e:
        print("Exception when calling AccessTokensApi->create_access_token: %s\n" % e)
        quit()

# Link shortening

configuration = urlr.Configuration(
    access_token = api_response.token
)

with urlr.ApiClient(configuration) as api_client:
    link_api = urlr.LinksApi(api_client)
    create_link_request = urlr.CreateLinkRequest.from_json('{"url": "","team_id": ""}')

    try:
        # Create a link
        api_response = link_api.create_link(create_link_request=create_link_request)
        print(api_response)
    except Exception as e:
        print("Exception when calling LinksApi->create_link: %s\n" % e)

A complete example is available here.

API Endpoints

All URIs are relative to https://urlr.me/api/v1

Class Method HTTP request Description
AccessTokensApi create_access_token POST /access_tokens/create Get an access token
AccessTokensApi refresh_access_token POST /access_tokens/refresh Refresh an access token
FoldersApi get_folders GET /folders/{team_id} Get folders of team
LinksApi create_link POST /links/create Create a link
LinksApi get_link GET /links/{link_id} Get a link
QRCodesApi create_qr_code POST /qrcodes/create Create a QR Code
StatisticsApi get_statistics POST /statistics Get statistics of a link
TeamsApi get_teams GET /teams Get teams of user

Models

Authorization

Authentication schemes defined for the API:

bearerAuth

  • Type: Bearer authentication (JWT)

Get help / support

Please contact [email protected] and we can take more direct action toward finding a solution.