pyixapi 0.1.4__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. {pyixapi-0.1.4 → pyixapi-0.2.1}/.github/workflows/publish.yml +1 -1
  2. {pyixapi-0.1.4/pyixapi.egg-info → pyixapi-0.2.1}/PKG-INFO +1 -1
  3. {pyixapi-0.1.4 → pyixapi-0.2.1}/pyixapi/core/api.py +15 -7
  4. {pyixapi-0.1.4 → pyixapi-0.2.1}/pyixapi/core/endpoint.py +15 -0
  5. {pyixapi-0.1.4 → pyixapi-0.2.1}/pyixapi/core/response.py +2 -2
  6. {pyixapi-0.1.4 → pyixapi-0.2.1}/pyixapi/models.py +4 -12
  7. {pyixapi-0.1.4 → pyixapi-0.2.1/pyixapi.egg-info}/PKG-INFO +1 -1
  8. {pyixapi-0.1.4 → pyixapi-0.2.1}/pyixapi.egg-info/requires.txt +1 -1
  9. pyixapi-0.2.1/requirements-dev.txt +2 -0
  10. {pyixapi-0.1.4 → pyixapi-0.2.1}/requirements.txt +1 -1
  11. {pyixapi-0.1.4 → pyixapi-0.2.1}/setup.py +1 -1
  12. pyixapi-0.1.4/requirements-dev.txt +0 -2
  13. {pyixapi-0.1.4 → pyixapi-0.2.1}/.github/FUNDING.yml +0 -0
  14. {pyixapi-0.1.4 → pyixapi-0.2.1}/.github/dependabot.yml +0 -0
  15. {pyixapi-0.1.4 → pyixapi-0.2.1}/.github/workflows/tests.yml +0 -0
  16. {pyixapi-0.1.4 → pyixapi-0.2.1}/.gitignore +0 -0
  17. {pyixapi-0.1.4 → pyixapi-0.2.1}/LICENSE +0 -0
  18. {pyixapi-0.1.4 → pyixapi-0.2.1}/README.md +0 -0
  19. {pyixapi-0.1.4 → pyixapi-0.2.1}/docs/Makefile +0 -0
  20. {pyixapi-0.1.4 → pyixapi-0.2.1}/docs/advanced.rst +0 -0
  21. {pyixapi-0.1.4 → pyixapi-0.2.1}/docs/conf.py +0 -0
  22. {pyixapi-0.1.4 → pyixapi-0.2.1}/docs/endpoint.rst +0 -0
  23. {pyixapi-0.1.4 → pyixapi-0.2.1}/docs/index.rst +0 -0
  24. {pyixapi-0.1.4 → pyixapi-0.2.1}/docs/request.rst +0 -0
  25. {pyixapi-0.1.4 → pyixapi-0.2.1}/docs/response.rst +0 -0
  26. {pyixapi-0.1.4 → pyixapi-0.2.1}/pyixapi/__init__.py +0 -0
  27. {pyixapi-0.1.4 → pyixapi-0.2.1}/pyixapi/core/__init__.py +0 -0
  28. {pyixapi-0.1.4 → pyixapi-0.2.1}/pyixapi/core/query.py +0 -0
  29. {pyixapi-0.1.4 → pyixapi-0.2.1}/pyixapi/core/token.py +0 -0
  30. {pyixapi-0.1.4 → pyixapi-0.2.1}/pyixapi/core/util.py +0 -0
  31. {pyixapi-0.1.4 → pyixapi-0.2.1}/pyixapi.egg-info/SOURCES.txt +0 -0
  32. {pyixapi-0.1.4 → pyixapi-0.2.1}/pyixapi.egg-info/dependency_links.txt +0 -0
  33. {pyixapi-0.1.4 → pyixapi-0.2.1}/pyixapi.egg-info/not-zip-safe +0 -0
  34. {pyixapi-0.1.4 → pyixapi-0.2.1}/pyixapi.egg-info/top_level.txt +0 -0
  35. {pyixapi-0.1.4 → pyixapi-0.2.1}/pyproject.toml +0 -0
  36. {pyixapi-0.1.4 → pyixapi-0.2.1}/setup.cfg +0 -0
  37. {pyixapi-0.1.4 → pyixapi-0.2.1}/tests/__init__.py +0 -0
  38. {pyixapi-0.1.4 → pyixapi-0.2.1}/tests/fixtures/api/authenticate.json +0 -0
  39. {pyixapi-0.1.4 → pyixapi-0.2.1}/tests/fixtures/api/refresh_authentication.json +0 -0
  40. {pyixapi-0.1.4 → pyixapi-0.2.1}/tests/test_api.py +0 -0
  41. {pyixapi-0.1.4 → pyixapi-0.2.1}/tests/util.py +0 -0
@@ -23,7 +23,7 @@ jobs:
23
23
  - name: Build package
24
24
  run: python -m build
25
25
  - name: Publish package
26
- uses: pypa/gh-action-pypi-publish@c7f29f7adef1a245bd91520e94867e5c6eedddcc
26
+ uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e
27
27
  with:
28
28
  user: __token__
29
29
  password: ${{ secrets.PYPI_API_TOKEN }}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyixapi
3
- Version: 0.1.4
3
+ Version: 0.2.1
4
4
  Summary: IX-API client library
5
5
  Home-page: https://github.com/peering-manager/pyixapi
6
6
  Author: Guillaume Mazoyer
@@ -24,13 +24,12 @@ from pyixapi.models import (
24
24
  PoP,
25
25
  Port,
26
26
  PortReservation,
27
- Product,
28
27
  ProductOffering,
29
28
  Role,
30
29
  RoleAssignment,
31
30
  )
32
31
 
33
- __version__ = "0.1.4"
32
+ __version__ = "0.2.1"
34
33
 
35
34
 
36
35
  class API(object):
@@ -61,7 +60,6 @@ class API(object):
61
60
  self.auth = Endpoint(self, "auth")
62
61
  self.connections = Endpoint(self, "connections", model=Connection)
63
62
  self.contacts = Endpoint(self, "contacts", model=Contact)
64
- self.customers = Endpoint(self, "customers", model=Account)
65
63
  self.demarcs = Endpoint(self, "demarcs", model=Demarc)
66
64
  self.devices = Endpoint(self, "devices", model=Device)
67
65
  self.facilities = Endpoint(self, "facilities", model=Facility)
@@ -76,7 +74,6 @@ class API(object):
76
74
  )
77
75
  self.network_services = Endpoint(self, "network-services", model=NetworkService)
78
76
  self.pops = Endpoint(self, "pops", model=PoP)
79
- self.products = Endpoint(self, "products", model=Product)
80
77
  # Version 2+
81
78
  self.member_joining_rules = Endpoint(
82
79
  self, "member-joining-rules", model=MemberJoiningRule
@@ -89,9 +86,6 @@ class API(object):
89
86
  self.port_reservations = Endpoint(
90
87
  self, "port-reservations", model=PortReservation
91
88
  )
92
- self.product_offerings = Endpoint(
93
- self, "product-offerings", model=ProductOffering
94
- )
95
89
  self.roles = Endpoint(self, "roles", model=Role)
96
90
  self.role_assignments = Endpoint(self, "role-assignments", model=RoleAssignment)
97
91
 
@@ -104,6 +98,20 @@ class API(object):
104
98
  base=self.url, token=self.access_token, http_session=self.http_session
105
99
  ).get_version()
106
100
 
101
+ @property
102
+ def accounts(self):
103
+ return Endpoint(
104
+ self, "customers" if self.version == 1 else "accounts", model=Account
105
+ )
106
+
107
+ @property
108
+ def product_offerings(self):
109
+ return Endpoint(
110
+ self,
111
+ "products" if self.version == 1 else "product-offerings",
112
+ model=ProductOffering,
113
+ )
114
+
107
115
  def authenticate(self):
108
116
  """
109
117
  Authenticate and generate a pair of tokens.
@@ -80,3 +80,18 @@ class Endpoint(object):
80
80
  return None
81
81
  else:
82
82
  raise e
83
+
84
+ def create(self, *args, **kwargs):
85
+ """
86
+ Creates an object on an endpoint.
87
+
88
+ Allows for the creation of new objects on an endpoint. Named arguments are
89
+ converted to JSON properties, and a single object is created.
90
+ """
91
+ req = Request(
92
+ base=self.url,
93
+ token=self.api.access_token,
94
+ http_session=self.api.http_session,
95
+ ).post(args[0] if args else kwargs)
96
+
97
+ return self.return_obj(req, self.api, self)
@@ -296,7 +296,7 @@ class Record(object):
296
296
  r = Request(
297
297
  key=self.id,
298
298
  base=self.endpoint.url,
299
- token=self.api.token,
299
+ token=self.api.access_token,
300
300
  http_session=self.api.http_session,
301
301
  )
302
302
  if r.patch(updates):
@@ -322,7 +322,7 @@ class Record(object):
322
322
  r = Request(
323
323
  key=self.id,
324
324
  base=self.endpoint.url,
325
- token=self.api.token,
325
+ token=self.api.access_token,
326
326
  http_session=self.api.http_session,
327
327
  )
328
328
  return True if r.delete() else False
@@ -154,10 +154,11 @@ class PoP(Record):
154
154
  return self.name
155
155
 
156
156
 
157
- class Product(Record):
157
+ class ProductOffering(Record):
158
158
  """
159
- A Product is a network or peering-related product of a defined type sold by an IXP
160
- to its customers.
159
+ A ProductOffering is an offer made by an exchange to be consumed by a client.
160
+
161
+ It is also referenced as "product" in IX-API v1.
161
162
  """
162
163
 
163
164
  def __str__(self):
@@ -226,15 +227,6 @@ class PortReservation(Record):
226
227
  return self.id
227
228
 
228
229
 
229
- class ProductOffering(Record):
230
- """
231
- A ProductOffering is an offer made by an exchange to be consumed by a client.
232
- """
233
-
234
- def __str__(self):
235
- return self.name
236
-
237
-
238
230
  class Role(Record):
239
231
  """
240
232
  A Role enables a Contact to act for a specific purpose.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyixapi
3
- Version: 0.1.4
3
+ Version: 0.2.1
4
4
  Summary: IX-API client library
5
5
  Home-page: https://github.com/peering-manager/pyixapi
6
6
  Author: Guillaume Mazoyer
@@ -1,2 +1,2 @@
1
1
  requests<3.0,>=2.20.0
2
- PyJWT<2.7,>=2.4.0
2
+ PyJWT<2.9,>=2.4.0
@@ -0,0 +1,2 @@
1
+ black~=23.7
2
+ pytest==7.4.*
@@ -1,2 +1,2 @@
1
- PyJWT>=2.4.0,<2.7
1
+ PyJWT>=2.4.0,<2.9
2
2
  requests>=2.20.0,<3.0
@@ -18,7 +18,7 @@ setup(
18
18
  use_scm_version=True,
19
19
  setup_requires=["setuptools_scm"],
20
20
  packages=find_packages(exclude=["tests", "tests.*"]),
21
- install_requires=["requests>=2.20.0,<3.0", "PyJWT>=2.4.0,<2.7"],
21
+ install_requires=["requests>=2.20.0,<3.0", "PyJWT>=2.4.0,<2.9"],
22
22
  zip_safe=False,
23
23
  keywords=["ix-api", "internet-exchange", "peering"],
24
24
  classifiers=[
@@ -1,2 +0,0 @@
1
- black~=23.1
2
- pytest==7.2.*
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes