Skip to content

Commit

Permalink
fix copy as python requests (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
wanghongenpin committed Nov 28, 2024
1 parent b02e3e1 commit a039d31
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 2 deletions.
9 changes: 8 additions & 1 deletion lib/ui/desktop/toolbar/setting/filter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ class _DomainListState extends State<DomainList> {
bool isPressed = false;
Offset? lastPressPosition;
bool changed = false;
bool _isSecondaryTapHandled = false;

onChanged() {
changed = true;
Expand Down Expand Up @@ -418,6 +419,10 @@ class _DomainListState extends State<DomainList> {
}

showGlobalMenu(Offset offset) {
if (_isSecondaryTapHandled) {
return;
}

showContextMenu(context, offset, items: [
PopupMenuItem(height: 35, child: Text(localizations.newBuilt), onTap: () => showEdit()),
PopupMenuItem(
Expand All @@ -436,11 +441,12 @@ class _DomainListState extends State<DomainList> {

//点击菜单
showMenus(TapDownDetails details, int index) {
if (selected.length > 1) {
if (selected.isNotEmpty) {
showGlobalMenu(details.globalPosition);
return;
}

_isSecondaryTapHandled = true;
setState(() {
selected[index] = true;
});
Expand All @@ -464,6 +470,7 @@ class _DomainListState extends State<DomainList> {
onChanged();
})
]).then((value) {
_isSecondaryTapHandled = false;
setState(() {
selected.remove(index);
});
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/python.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void processHeaders(StringBuffer py, List<String> headers) {
first = false;
}
var parts = header.splitFirst(HttpConstants.colon);
py.write('"${parts[0].trim()}": "${escapeQuotes(parts[1].substring(2, parts[1].length - 1).trim())}"');
py.write('"${parts[0].trim()}": "${escapeQuotes(parts[1].substring(1, parts[1].length - 1).trim())}"');
}
}
if (!first) {
Expand Down
52 changes: 52 additions & 0 deletions test/requests_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import requests

url = "https://h5api.m.taobao.com/h5/mtop.mediaplatform.live.check.info/2.0/?jsv=2.7.0&appKey=25278248&t=1732545137533&sign=b71dc9348c00e460e7db0dba8b513495&api=mtop.mediaplatform.live.check.info&v=2.0&appVersion=7.9.0&needLogin=true&type=jsonp&dataType=jsonp&callback=mtopjsonp6763&data=%7B%22liveId%22%3A%22495202688287%22%7D"
cookies = {
"_samesite_flag_": "true",
"3PcFlag": "1732539699265",
"cookie2": "2c97dd390875418088acaa436b687cc4",
"t": "212cdd2cad20329e374764f215e28d33",
"_tb_token_": "f54f43ea53973",
"cna": "MxXLH2+8sn4BASQIiAaiRXvA",
"xlly_s": "1",
"sgcookie": "E100eCj3Vo3hPWjpiAQHe9Vdpf%2FU1q56ubBnkTao3MLYNOwCDJMIoxNP0N95EDJCMbLAGtlajDN6h4kOPL5irIRnvzXL%2FdwWk0odkxb0q0OYr9I%3D",
"wk_cookie2": "1c385564ef446df05a58aab8a797594e",
"wk_unb": "UUpgQcERb4upQSXAhw%3D%3D",
"unb": "2217346076826",
"csg": "9b8d1f42",
"lgc": "%5Cu4F1A%5Cu751F88f",
"cancelledSubSites": "empty",
"cookie17": "UUpgQcERb4upQSXAhw%3D%3D",
"dnk": "%5Cu4F1A%5Cu751F88f",
"skt": "fb8ebd9e1cdb4de1",
"existShop": "MTczMjUzOTc4OQ%3D%3D",
"tracknick": "%5Cu4F1A%5Cu751F88f",
"_cc_": "V32FPkk%2Fhw%3D%3D",
"_l_g_": "Ug%3D%3D",
"sg": "f64",
"_nk_": "%5Cu4F1A%5Cu751F88f",
"cookie1": "VFQmwCET8bF7o5l%2BzlwVznTxRGu9ynM%2FsGiPW5MQBFU%3D",
"_m_h5_tk": "6459e3cd4d54401ea1cb2eac7bcc378e_1732548069723",
"_m_h5_tk_enc": "6c112cba6d346180d67cd9c6492fdef4",
"isg": "BAkJZPdMivyidHYIXlTZBDrrGDVjVv2I8uSScqt-hfAv8ikE86YNWPegMF7EsZXA",
}

headers = {
"Host": "h5api.m.taobao.com",
"Connection": "keep-alive",
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "en-US",
"Origin": "https://liveplatform.taobao.com",
"Referer": "https://liveplatform.taobao.com",
"Sec-Fetch-Dest": "script",
"Sec-Fetch-Mode": "no-cors",
"Sec-Fetch-Site": "cross-site",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) live-anchor-workbench/7.9.0 Chrome/106.0.5249.199 Electron/21.4.4 Safari/537.36 12574478.live-anchor-workbench.electron",
"sec-ch-ua": "\"Not;A=Brand\";v=\"99\", \"Chromium\";v=\"106\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\""
}

res = requests.get(url, headers=headers, cookies=cookies)
print(res.text)

0 comments on commit a039d31

Please sign in to comment.