Skip to content

Commit

Permalink
fix: formatting python code
Browse files Browse the repository at this point in the history
  • Loading branch information
DDSRem committed Dec 28, 2024
1 parent 151ceff commit d454672
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 15 deletions.
9 changes: 3 additions & 6 deletions aliyuntvtoken_connector/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,23 @@
import json
import base64
import requests
import requests
import json
import uuid
import hashlib
import base64
import random


app = Flask(__name__)
headers = {
"token": "6733b42e28cdba32",
'User-Agent': 'Mozilla/5.0 (Linux; U; Android 9; zh-cn; SM-S908E Build/TP1A.220624.014) AppleWebKit/533.1 (KHTML, like Gecko) Mobile Safari/533.1',
'User-Agent': 'Mozilla/5.0 (Linux; U; Android 9; zh-cn; SM-S908E Build/TP1A.220624.014) AppleWebKit/533.1 (KHTML, like Gecko) Mobile Safari/533.1', # noqa: E501
'Host': 'api.extscreen.com'
}


def h(char_array, modifier):
unique_chars = list(dict.fromkeys(char_array))
numeric_modifier = int(modifier[7:])
transformed_string = "".join([chr(abs(ord(c) - (numeric_modifier % 127) - 1) + 33 if abs(ord(c) - (numeric_modifier % 127) - 1) < 33 else
transformed_string = "".join([chr(abs(ord(c) - (numeric_modifier % 127) - 1) + 33 if abs(ord(c) - (numeric_modifier % 127) - 1) < 33 else # noqa: E501
abs(ord(c) - (numeric_modifier % 127) - 1)) for c in unique_chars])
return transformed_string

Expand Down Expand Up @@ -78,7 +75,7 @@ def oauth_token():
unique_id = uuid.uuid4().hex
wifimac = str(random.randint(10**11, 10**12 - 1))

resp = requests.post("http://api.extscreen.com/aliyundrive/v3/token", data=req_body, headers={**get_params(timestamp, unique_id, wifimac), **headers})
resp = requests.post("http://api.extscreen.com/aliyundrive/v3/token", data=req_body, headers={**get_params(timestamp, unique_id, wifimac), **headers}) # noqa: E501
if resp.status_code == 200:
resp_data = resp.json()
ciphertext = resp_data["data"]["ciphertext"]
Expand Down
2 changes: 1 addition & 1 deletion glue_python/aliyuntoken/aliyuntoken.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "cross-site",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36"
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36" # noqa: E501
}


Expand Down
8 changes: 0 additions & 8 deletions pyproject.toml

This file was deleted.

36 changes: 36 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]
line-length = 120
target-version = "py312"
lint.select = [
"F",
"E",
"W",
"UP",
]

0 comments on commit d454672

Please sign in to comment.