sfq 0.0.2__py3-none-any.whl → 0.0.4__py3-none-any.whl

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.
sfq/__init__.py CHANGED
@@ -5,7 +5,7 @@ import os
5
5
  import json
6
6
  from urllib.parse import urlparse, quote
7
7
 
8
- logging.basicConfig(level=logging.INFO)
8
+ logging.basicConfig(level=logging.INFO, format='[sfq:%(lineno)d - %(levelname)s] %(message)s')
9
9
 
10
10
  class SFAuth:
11
11
  def __init__(
@@ -108,7 +108,7 @@ class SFAuth:
108
108
  """Automatically refresh the token if it has expired or is missing."""
109
109
  _token_expiration = self._is_token_expired()
110
110
  if self.access_token and not _token_expiration:
111
- return
111
+ return self.access_token
112
112
 
113
113
  if not self.access_token:
114
114
  logging.debug("No access token available. Requesting a new one.")
@@ -123,11 +123,15 @@ class SFAuth:
123
123
  logging.debug("Access token refreshed successfully.")
124
124
  else:
125
125
  logging.error("Failed to refresh access token.")
126
+ return self.access_token
126
127
 
127
128
 
128
129
  def _is_token_expired(self):
129
130
  """Check if the access token has expired."""
130
- return time.time() >= self.token_expiration_time
131
+ try:
132
+ return time.time() >= float(self.token_expiration_time)
133
+ except (TypeError, ValueError):
134
+ return False
131
135
 
132
136
  def query(self, query, tooling=False):
133
137
  """Query Salesforce using SOQL or Tooling API, depending on the `tooling` parameter."""
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: sfq
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: Python wrapper for the Salesforce's Query API.
5
5
  Author-email: David Moruzzi <sfq.pypi@dmoruzi.com>
6
6
  Keywords: salesforce,salesforce query
@@ -0,0 +1,5 @@
1
+ sfq/__init__.py,sha256=4MnDoSE32i6H_VF_WFyEN171kcyhfbI7GI4B_QAZMG4,6467
2
+ sfq/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ sfq-0.0.4.dist-info/METADATA,sha256=kwZf2zmeERpSoj_GOmDtxKwxFF6N52txZVkEnYWH6NY,4685
4
+ sfq-0.0.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
5
+ sfq-0.0.4.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.26.3
2
+ Generator: hatchling 1.27.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,5 +0,0 @@
1
- sfq/__init__.py,sha256=fn9dqDL6OgRiUugoycL-e1-prr_Heo0CsW-uNLfcj2k,6272
2
- sfq/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- sfq-0.0.2.dist-info/METADATA,sha256=ro8AkQIqw2rQ55Cv4NR004_VkCrNhwo4Q5M6mIn87sA,4685
4
- sfq-0.0.2.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
5
- sfq-0.0.2.dist-info/RECORD,,