sfq 0.0.5__py3-none-any.whl → 0.0.7__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
@@ -13,12 +13,13 @@ class SFAuth:
|
|
13
13
|
instance_url,
|
14
14
|
client_id,
|
15
15
|
refresh_token,
|
16
|
-
api_version="
|
16
|
+
api_version="v63.0",
|
17
17
|
token_endpoint="/services/oauth2/token",
|
18
18
|
access_token=None,
|
19
19
|
token_expiration_time=None,
|
20
20
|
token_lifetime=15 * 60,
|
21
21
|
proxy="auto",
|
22
|
+
user_agent="sfq/0.0.7",
|
22
23
|
):
|
23
24
|
"""
|
24
25
|
Initializes the SFAuth with necessary parameters.
|
@@ -42,6 +43,7 @@ class SFAuth:
|
|
42
43
|
self.token_expiration_time = token_expiration_time
|
43
44
|
self.token_lifetime = token_lifetime
|
44
45
|
self._auto_configure_proxy(proxy)
|
46
|
+
self.user_agent = user_agent
|
45
47
|
|
46
48
|
def _auto_configure_proxy(self, proxy):
|
47
49
|
"""
|
@@ -83,7 +85,7 @@ class SFAuth:
|
|
83
85
|
parsed_url = urlparse(self.instance_url)
|
84
86
|
conn = self._create_connection(parsed_url.netloc)
|
85
87
|
|
86
|
-
headers = {"Content-Type": "application/x-www-form-urlencoded"}
|
88
|
+
headers = {"Content-Type": "application/x-www-form-urlencoded", "User-Agent": self.user_agent}
|
87
89
|
body = "&".join([f"{key}={quote(str(value))}" for key, value in payload.items()])
|
88
90
|
|
89
91
|
try:
|
@@ -146,7 +148,7 @@ class SFAuth:
|
|
146
148
|
else:
|
147
149
|
query_endpoint = f"/services/data/{self.api_version}/query"
|
148
150
|
|
149
|
-
headers = {"Authorization": f"Bearer {self.access_token}"}
|
151
|
+
headers = {"Authorization": f"Bearer {self.access_token}", "User-Agent": self.user_agent}
|
150
152
|
|
151
153
|
# Handle special characters in the query
|
152
154
|
encoded_query = quote(query)
|
sfq/__main__.py
CHANGED
@@ -47,9 +47,7 @@ def _interactive_shell(sf: SFAuth, dry_run: bool, disable_fuzzy_completion: bool
|
|
47
47
|
host = sf.instance_url.split("://")[1].split("/")[0]
|
48
48
|
conn = http.client.HTTPSConnection(host)
|
49
49
|
uri = f"/services/data/{sf.api_version}/sobjects/"
|
50
|
-
|
51
|
-
headers = {'Authorization': f'Bearer {token}'}
|
52
|
-
print(f'token: {token}')
|
50
|
+
headers = {'Authorization': f'Bearer {sf._refresh_token_if_needed()}'}
|
53
51
|
conn.request("GET", uri, headers=headers)
|
54
52
|
response = conn.getresponse()
|
55
53
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: sfq
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.7
|
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
|
@@ -114,7 +114,7 @@ To use the `sfq` library, you'll need a **client ID** and **refresh token**. The
|
|
114
114
|
"status": 0,
|
115
115
|
"result": {
|
116
116
|
"id": "00Daa0000000000000",
|
117
|
-
"apiVersion": "
|
117
|
+
"apiVersion": "63.0",
|
118
118
|
"accessToken": "your-access-token-here",
|
119
119
|
"instanceUrl": "https://example-dev-ed.trailblaze.my.salesforce.com",
|
120
120
|
"username": "user@example.com",
|
@@ -0,0 +1,6 @@
|
|
1
|
+
sfq/__init__.py,sha256=UvDYd9Iu6Fh_S0TKujWXyClhCk5dsz2Yq1X7xFsPbT4,6597
|
2
|
+
sfq/__main__.py,sha256=XDb-hRo7jkB3nbHJkQCxL0eUx2Sgl_C3Rr_peuOd6fs,5724
|
3
|
+
sfq/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
+
sfq-0.0.7.dist-info/METADATA,sha256=TZJnKAi1WddBKHXhDJrAxaLPhcbhI3jR0NBesnpcMnk,5491
|
5
|
+
sfq-0.0.7.dist-info/WHEEL,sha256=KGYbc1zXlYddvwxnNty23BeaKzh7YuoSIvIMO4jEhvw,87
|
6
|
+
sfq-0.0.7.dist-info/RECORD,,
|
sfq-0.0.5.dist-info/RECORD
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
sfq/__init__.py,sha256=sIZr8eUzWV9q2PEenbCnu4mRBmv07FC7zjfpcjux_1g,6466
|
2
|
-
sfq/__main__.py,sha256=CqwwG2l6ZphmiOSeqQeB7W73hTlGKJRDYtlKLkM7Bps,5779
|
3
|
-
sfq/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
-
sfq-0.0.5.dist-info/METADATA,sha256=1f9a_TSpoLzcyMbqRrxwVyCqE5vj_WCivEg6uxNiNxQ,5491
|
5
|
-
sfq-0.0.5.dist-info/WHEEL,sha256=KGYbc1zXlYddvwxnNty23BeaKzh7YuoSIvIMO4jEhvw,87
|
6
|
-
sfq-0.0.5.dist-info/RECORD,,
|
File without changes
|