Skip to content

Commit 664350f

Browse files
committed
1 parent 80b10c6 commit 664350f

File tree

8 files changed

+78
-42
lines changed

8 files changed

+78
-42
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## [2.11.1] - 2025-08-07
4+
- Better documentation and examples.
5+
36
## [2.11.0] - 2025-08-07
47

58
### Changed

README.md

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
1+
22

33
![PyPI - Version](https://img.shields.io/pypi/v/urlr) ![PyPI - Downloads](https://img.shields.io/pypi/dm/urlr) ![PyPI - License](https://img.shields.io/pypi/l/urlr)
44

55
This SDK is automatically generated with the [OpenAPI Generator](https://openapi-generator.tech) project.
66

77
- API version: 1.10
8-
- Package version: 2.11.0
8+
- Package version: 2.11.1
99
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
1010

1111
For more information, please visit [https://urlr.me/en](https://urlr.me/en)
@@ -50,39 +50,50 @@ Execute `pytest` to run the tests.
5050
Please follow the [installation procedure](#installation--usage) and then run the following:
5151

5252
```python
53+
import os
5354
import urlr
5455
from urlr.rest import ApiException
55-
from pprint import pprint
56+
57+
username = os.getenv("URLR_API_USERNAME") # to be defined on your side
58+
password = os.getenv("URLR_API_PASSWORD") # to be defined on your side
59+
5660

5761
# Access Tokens
5862

59-
with urlr.ApiClient() as api_client:
60-
access_tokens_api = urlr.AccessTokensApi(api_client)
61-
62-
access_tokens_request = urlr.AccessTokensRequest.from_json('{"username": "","password": ""}')
63+
configuration = urlr.Configuration()
64+
65+
with urlr.ApiClient(configuration) as api_client:
66+
access_token_api = urlr.AccessTokensApi(api_client)
67+
68+
create_access_token_request = urlr.CreateAccessTokenRequest(
69+
username=username,
70+
password=password,
71+
)
6372

6473
try:
65-
api_response = access_tokens_api.create_access_token(access_tokens_request=access_tokens_request)
74+
api_response = access_token_api.create_access_token(
75+
create_access_token_request=create_access_token_request)
6676
except ApiException as e:
6777
print("Exception when calling AccessTokensApi->create_access_token: %s\n" % e)
6878
quit()
6979

70-
# Link shortening
80+
configuration.access_token = api_response.token
7181

72-
configuration = urlr.Configuration(
73-
access_token = api_response.token
74-
)
82+
# Create a link
7583

7684
with urlr.ApiClient(configuration) as api_client:
77-
link_api = urlr.LinksApi(api_client)
78-
create_link_request = urlr.CreateLinkRequest.from_json('{"url": "","team_id": ""}')
85+
links_api = urlr.LinksApi(api_client)
86+
create_link_request = urlr.CreateLinkRequest(
87+
url="",
88+
team_id=""
89+
)
7990

8091
try:
81-
# Create a link
82-
api_response = link_api.create_link(create_link_request=create_link_request)
83-
print(api_response)
92+
link = links_api.create_link(
93+
create_link_request=create_link_request)
8494
except Exception as e:
8595
print("Exception when calling LinksApi->create_link: %s\n" % e)
96+
8697
```
8798

8899
A complete example is [available here](examples/example1.py).

examples/example1.py

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,66 @@
1+
import os
12
import urlr
23
from urlr.rest import ApiException
3-
from pprint import pprint
4+
5+
username = os.getenv("URLR_API_USERNAME") # to define on your end
6+
password = os.getenv("URLR_API_PASSWORD") # to define on your end
7+
48

59
# Access Tokens
610

7-
with urlr.ApiClient() as api_client:
8-
access_tokens_api = urlr.AccessTokensApi(api_client)
9-
10-
access_tokens_request = urlr.AccessTokensRequest.from_json('{"username": "","password": ""}')
11+
configuration = urlr.Configuration()
12+
13+
with urlr.ApiClient(configuration) as api_client:
14+
access_token_api = urlr.AccessTokensApi(api_client)
15+
16+
create_access_token_request = urlr.CreateAccessTokenRequest(
17+
username=username,
18+
password=password,
19+
)
1120

1221
try:
13-
api_response = access_tokens_api.create_access_token(access_tokens_request=access_tokens_request)
22+
api_response = access_token_api.create_access_token(
23+
create_access_token_request=create_access_token_request)
1424
except ApiException as e:
1525
print("Exception when calling AccessTokensApi->create_access_token: %s\n" % e)
1626
quit()
1727

18-
# Link shortening
28+
configuration.access_token = api_response.token
29+
30+
# Workspaces - get workspace id
31+
32+
with urlr.ApiClient(configuration) as api_client:
33+
workspaces_api = urlr.WorkspacesApi(api_client)
34+
try:
35+
workspaces = workspaces_api.get_teams()
36+
workspace_id = workspaces.teams[0].id
37+
except Exception as e:
38+
print("Exception when calling WorkspacesApi->get_teams: %s\n" % e)
1939

20-
configuration = urlr.Configuration(
21-
access_token = api_response.token
22-
)
40+
# Create a link
2341

2442
with urlr.ApiClient(configuration) as api_client:
25-
link_api = urlr.LinksApi(api_client)
26-
create_link_request = urlr.CreateLinkRequest.from_json('{"url": "","team_id": ""}')
43+
links_api = urlr.LinksApi(api_client)
44+
create_link_request = urlr.CreateLinkRequest(
45+
url="https://github.com/URLR",
46+
team_id=workspace_id
47+
)
2748

2849
try:
29-
api_response = link_api.create_link(create_link_request=create_link_request)
30-
pprint(api_response)
50+
link = links_api.create_link(
51+
create_link_request=create_link_request)
3152
except Exception as e:
32-
pprint("Exception when calling LinksApi->create_link: %s\n" % e)
53+
print("Exception when calling LinksApi->create_link: %s\n" % e)
3354

34-
# Statistics
55+
# Get statistics
3556

3657
with urlr.ApiClient(configuration) as api_client:
3758
statistics_api = urlr.StatisticsApi(api_client)
38-
statistics_request = urlr.StatisticsRequest.from_json('{"link_id": ""}')
59+
get_statistics_request = urlr.GetStatisticsRequest(link_id=link.id)
3960

4061
try:
41-
api_response = statistics_api.get_statistics(statistics_request=statistics_request)
42-
pprint(api_response)
62+
api_response = statistics_api.get_statistics(
63+
get_statistics_request=get_statistics_request)
64+
print(api_response)
4365
except Exception as e:
44-
print("Exception when calling StatisticsApi->get_statistics: %s\n" % e)
66+
print("Exception when calling StatisticsApi->get_statistics: %s\n" % e)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "urlr"
3-
version = "2.11.0"
3+
version = "2.11.1"
44
description = "Python client for URLR"
55
authors = [
66
{name = "URLR",email = "[email protected]"},

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# prerequisite: setuptools
2323
# http://pypi.python.org/pypi/setuptools
2424
NAME = "urlr"
25-
VERSION = "2.11.0"
25+
VERSION = "2.11.1"
2626
PYTHON_REQUIRES = ">= 3.9"
2727
REQUIRES = [
2828
"urllib3 >= 2.1.0, < 3.0.0",

urlr/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
""" # noqa: E501
1616

1717

18-
__version__ = "2.11.0"
18+
__version__ = "2.11.1"
1919

2020
# Define package exports
2121
__all__ = [

urlr/api_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __init__(
9191
self.default_headers[header_name] = header_value
9292
self.cookie = cookie
9393
# Set default User-Agent.
94-
self.user_agent = 'OpenAPI-Generator/2.11.0/python'
94+
self.user_agent = 'OpenAPI-Generator/2.11.1/python'
9595
self.client_side_validation = configuration.client_side_validation
9696

9797
def __enter__(self):

urlr/configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ def to_debug_report(self) -> str:
512512
"OS: {env}\n"\
513513
"Python Version: {pyversion}\n"\
514514
"Version of the API: 1.10\n"\
515-
"SDK Package Version: 2.11.0".\
515+
"SDK Package Version: 2.11.1".\
516516
format(env=sys.platform, pyversion=sys.version)
517517

518518
def get_host_settings(self) -> List[HostSetting]:

0 commit comments

Comments
 (0)