PyLinks 0.0.0.dev39__tar.gz → 0.0.0.dev41__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 (35) hide show
  1. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/PKG-INFO +3 -3
  2. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/pyproject.toml +3 -3
  3. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/PyLinks.egg-info/PKG-INFO +3 -3
  4. pylinks-0.0.0.dev41/src/PyLinks.egg-info/requires.txt +3 -0
  5. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/exception/api.py +22 -0
  6. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/http.py +5 -2
  7. pylinks-0.0.0.dev39/src/PyLinks.egg-info/requires.txt +0 -3
  8. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/README.md +0 -0
  9. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/setup.cfg +0 -0
  10. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/PyLinks.egg-info/SOURCES.txt +0 -0
  11. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/PyLinks.egg-info/dependency_links.txt +0 -0
  12. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/PyLinks.egg-info/not-zip-safe +0 -0
  13. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/PyLinks.egg-info/top_level.txt +0 -0
  14. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/__init__.py +0 -0
  15. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/_settings.py +0 -0
  16. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/api/__init__.py +0 -0
  17. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/api/doi.py +0 -0
  18. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/api/github.py +0 -0
  19. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/api/orcid.py +0 -0
  20. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/exception/__init__.py +0 -0
  21. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/exception/base.py +0 -0
  22. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/exception/media_type.py +0 -0
  23. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/exception/uri.py +0 -0
  24. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/media_type.py +0 -0
  25. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/site/__init__.py +0 -0
  26. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/site/binder.py +0 -0
  27. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/site/conda.py +0 -0
  28. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/site/github.py +0 -0
  29. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/site/lib_io.py +0 -0
  30. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/site/pypi.py +0 -0
  31. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/site/readthedocs.py +0 -0
  32. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/string.py +0 -0
  33. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/uri/__init__.py +0 -0
  34. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/uri/data.py +0 -0
  35. {pylinks-0.0.0.dev39 → pylinks-0.0.0.dev41}/src/pylinks/url.py +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyLinks
3
- Version: 0.0.0.dev39
3
+ Version: 0.0.0.dev41
4
4
  Requires-Python: >=3.10
5
5
  Requires-Dist: requests<3,>=2.31.0
6
- Requires-Dist: ExceptionMan==0.0.0.dev26
7
- Requires-Dist: MDit==0.0.0.dev26
6
+ Requires-Dist: ExceptionMan==0.0.0.dev28
7
+ Requires-Dist: MDit==0.0.0.dev28
@@ -17,12 +17,12 @@ namespaces = true
17
17
  # ----------------------------------------- Project Metadata -------------------------------------
18
18
  #
19
19
  [project]
20
- version = "0.0.0.dev39"
20
+ version = "0.0.0.dev41"
21
21
  name = "PyLinks"
22
22
  dependencies = [
23
23
  "requests >= 2.31.0, < 3",
24
- "ExceptionMan == 0.0.0.dev26",
25
- "MDit == 0.0.0.dev26",
24
+ "ExceptionMan == 0.0.0.dev28",
25
+ "MDit == 0.0.0.dev28",
26
26
  ]
27
27
  requires-python = ">=3.10"
28
28
 
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyLinks
3
- Version: 0.0.0.dev39
3
+ Version: 0.0.0.dev41
4
4
  Requires-Python: >=3.10
5
5
  Requires-Dist: requests<3,>=2.31.0
6
- Requires-Dist: ExceptionMan==0.0.0.dev26
7
- Requires-Dist: MDit==0.0.0.dev26
6
+ Requires-Dist: ExceptionMan==0.0.0.dev28
7
+ Requires-Dist: MDit==0.0.0.dev28
@@ -0,0 +1,3 @@
1
+ requests<3,>=2.31.0
2
+ ExceptionMan==0.0.0.dev28
3
+ MDit==0.0.0.dev28
@@ -2,9 +2,11 @@
2
2
 
3
3
  from __future__ import annotations as _annotations
4
4
 
5
+ import json
5
6
  from typing import TYPE_CHECKING as _TYPE_CHECKING
6
7
 
7
8
  import mdit as _mdit
9
+ import json as _json
8
10
  from pylinks.exception import PyLinksError
9
11
 
10
12
  if _TYPE_CHECKING:
@@ -94,6 +96,26 @@ class WebAPIValueError(WebAPIError):
94
96
  return
95
97
 
96
98
 
99
+ class GraphQLResponseError(WebAPIError):
100
+ """
101
+ Exception class for GraphQL
102
+ """
103
+
104
+ def __init__(self, response: dict):
105
+ if "errors" in response:
106
+ intro = "GraphQL response contains errors."
107
+ elif "data" not in response:
108
+ intro = "GraphQL response does not contain data."
109
+ super().__init__(
110
+ title="GraphQL Response Error",
111
+ intro=intro,
112
+ details=_mdit.element.code_block(
113
+ json.dumps(response, indent=3), language="json", caption="GraphQL Response"
114
+ ),
115
+ )
116
+ return
117
+
118
+
97
119
  def _process_response(response: Response):
98
120
  # Decode error reason from server
99
121
  # This part is adapted from `requests` library; See PR #3538 on their GitHub
@@ -8,6 +8,8 @@ from typing import TYPE_CHECKING as _TYPE_CHECKING, NamedTuple as _NamedTuple
8
8
  import time
9
9
  from functools import wraps
10
10
  from pathlib import Path
11
+
12
+ import mdit as _mdit
11
13
  import requests
12
14
 
13
15
  from pylinks.exception import api as _exception
@@ -273,10 +275,11 @@ def graphql_query(
273
275
  args["json"]["variables"] = variables
274
276
  response = request(**args)
275
277
  if isinstance(response, dict):
278
+ error_title = "GraphQL API Error"
276
279
  if "errors" in response:
277
- raise _exception.WebAPIError(response)
280
+ raise _exception.GraphQLResponseError(response)
278
281
  elif "data" not in response:
279
- raise _exception.WebAPIError(response)
282
+ raise _exception.GraphQLResponseError(response)
280
283
  else:
281
284
  response = response["data"]
282
285
  return response
@@ -1,3 +0,0 @@
1
- requests<3,>=2.31.0
2
- ExceptionMan==0.0.0.dev26
3
- MDit==0.0.0.dev26
File without changes
File without changes