hyper-sdk 0.1.0__tar.gz → 0.1.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hyper_sdk
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Hyper Solutions Python SDK
5
5
  Project-URL: homepage, https://github.com/Hyper-Solutions/hyper-sdk-py
6
6
  Classifier: Intended Audience :: Developers
@@ -84,7 +84,7 @@ The Akamai package provides functions for handling sec-cpt challenges:
84
84
 
85
85
  - `SecCptChallenge.parse`: Parses a sec-cpt challenge from an HTML source.
86
86
  - `generate_sec_cpt_payload`: Generates a sec-cpt payload using the provided sec-cpt cookie.
87
- - `update_sec_cpt_challenge_data`: Updates the challenge data of a `SecCptChallenge` instance from a response body.
87
+ - `sleep`: Sleeps for the duration specified in the sec-cpt challenge.
88
88
 
89
89
  Example usage:
90
90
 
@@ -93,7 +93,7 @@ from hyper_sdk.akamai.sec_cpt import SecCptChallenge
93
93
 
94
94
  challenge = SecCptChallenge.parse(html_source)
95
95
  payload = challenge.generate_sec_cpt_payload(sec_cpt_cookie)
96
- challenge.update_sec_cpt_challenge_data(response_body)
96
+ challenge.sleep()
97
97
  ```
98
98
 
99
99
  ### Validating Cookies
@@ -65,7 +65,7 @@ The Akamai package provides functions for handling sec-cpt challenges:
65
65
 
66
66
  - `SecCptChallenge.parse`: Parses a sec-cpt challenge from an HTML source.
67
67
  - `generate_sec_cpt_payload`: Generates a sec-cpt payload using the provided sec-cpt cookie.
68
- - `update_sec_cpt_challenge_data`: Updates the challenge data of a `SecCptChallenge` instance from a response body.
68
+ - `sleep`: Sleeps for the duration specified in the sec-cpt challenge.
69
69
 
70
70
  Example usage:
71
71
 
@@ -74,7 +74,7 @@ from hyper_sdk.akamai.sec_cpt import SecCptChallenge
74
74
 
75
75
  challenge = SecCptChallenge.parse(html_source)
76
76
  payload = challenge.generate_sec_cpt_payload(sec_cpt_cookie)
77
- challenge.update_sec_cpt_challenge_data(response_body)
77
+ challenge.sleep()
78
78
  ```
79
79
 
80
80
  ### Validating Cookies
@@ -3,6 +3,7 @@ import hashlib
3
3
  import json
4
4
  import os
5
5
  import re
6
+ import time
6
7
  from collections import OrderedDict
7
8
  from typing import List
8
9
 
@@ -72,6 +73,8 @@ class SecCptChallenge:
72
73
 
73
74
  def generate_sec_cpt_payload(self, sec_cpt_cookie: str) -> str:
74
75
  sec, _, _ = sec_cpt_cookie.partition("~")
76
+ if sec == sec_cpt_cookie:
77
+ raise Exception("hyper-sdk: Malformed sec_cpt cookie.")
75
78
 
76
79
  answers = self._generate_sec_cpt_answers(sec)
77
80
 
@@ -82,14 +85,8 @@ class SecCptChallenge:
82
85
 
83
86
  return json.dumps(payload)
84
87
 
85
- def update_sec_cpt_challenge_data(self, response_body: str):
86
- challenge_data = json.loads(response_body)
87
- self.challenge_data = SecCptChallengeData(
88
- challenge_data.get('token', ''),
89
- challenge_data.get('timestamp', 0),
90
- challenge_data.get('nonce', ''),
91
- challenge_data.get('difficulty', 0)
92
- )
88
+ def sleep(self):
89
+ time.sleep(self.duration)
93
90
 
94
91
  def _generate_sec_cpt_answers(self, sec: str) -> List[str]:
95
92
  answers = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hyper_sdk
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Hyper Solutions Python SDK
5
5
  Project-URL: homepage, https://github.com/Hyper-Solutions/hyper-sdk-py
6
6
  Classifier: Intended Audience :: Developers
@@ -84,7 +84,7 @@ The Akamai package provides functions for handling sec-cpt challenges:
84
84
 
85
85
  - `SecCptChallenge.parse`: Parses a sec-cpt challenge from an HTML source.
86
86
  - `generate_sec_cpt_payload`: Generates a sec-cpt payload using the provided sec-cpt cookie.
87
- - `update_sec_cpt_challenge_data`: Updates the challenge data of a `SecCptChallenge` instance from a response body.
87
+ - `sleep`: Sleeps for the duration specified in the sec-cpt challenge.
88
88
 
89
89
  Example usage:
90
90
 
@@ -93,7 +93,7 @@ from hyper_sdk.akamai.sec_cpt import SecCptChallenge
93
93
 
94
94
  challenge = SecCptChallenge.parse(html_source)
95
95
  payload = challenge.generate_sec_cpt_payload(sec_cpt_cookie)
96
- challenge.update_sec_cpt_challenge_data(response_body)
96
+ challenge.sleep()
97
97
  ```
98
98
 
99
99
  ### Validating Cookies
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "hyper_sdk"
7
- version = "0.1.0"
7
+ version = "0.1.1"
8
8
  description = "Hyper Solutions Python SDK"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.6"
File without changes
File without changes