vchrome 0.0.13__py3-none-any.whl → 0.0.14__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.
vchrome/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = '0.0.13'
1
+ __version__ = '0.0.14'
2
2
  __author__ = 'v'
3
3
  # ----------------------------------------------------------------------------------------------------
4
4
  _allowed = {'Chrome'}
@@ -2016,7 +2016,25 @@ def cdp_client(hostname, port, debug=False):
2016
2016
  raise Exception('type error must be str/list[str], curr type:'+type(acceptLanguage))
2017
2017
  d['acceptLanguage'] = acceptLanguage
2018
2018
  if is_lang:
2019
- lang = acceptLanguage.split(',')[0]
2019
+ langs = acceptLanguage.split(',')
2020
+ lang = langs[0]
2021
+ script = ('''
2022
+ !function(){
2023
+ // init_lang_and_langs by vchrome
2024
+ var Np = Object.getPrototypeOf(navigator)
2025
+ var Odp = Object.defineProperty
2026
+ Odp(Np, "language", { get() { return '''+json.dumps(lang)+'''; }, configurable: true, enumerable: true });
2027
+ Odp(Np, "languages", { get() { return '''+json.dumps(langs)+'''; }, configurable: true, enumerable: true });
2028
+ }()
2029
+ ''')
2030
+ has_lang_script = False
2031
+ for s in self.f._wok_script:
2032
+ if 'init_lang_and_langs by vchrome' in s:
2033
+ has_lang_script = s
2034
+ break
2035
+ if has_lang_script:
2036
+ self.f._wok_script.remove(has_lang_script)
2037
+ self.f._wok_script = [script] + self.f._wok_script
2020
2038
  auto_timezone = self.guess_timezone_from_language(lang)
2021
2039
  if auto_timezone:
2022
2040
  self.f.cdp('Emulation.setTimezoneOverride', {"timezoneId":auto_timezone})
@@ -1,3 +1,3 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vchrome
3
- Version: 0.0.13
3
+ Version: 0.0.14
@@ -0,0 +1,6 @@
1
+ v/__init__.py,sha256=7sbAHSk_EElMBcJeHVoXGMmt9bqmci36NWFVRk1sUn4,21
2
+ vchrome/__init__.py,sha256=6KTnoSpARmueBtC3Q7fQy6v1OZYiDnE4JFjzVsqW5f0,215868
3
+ vchrome-0.0.14.dist-info/METADATA,sha256=oiIDr6bYgJJ_Y_cZKhXbJSKRGMpp1jQ3HCmgt7uEhr4,55
4
+ vchrome-0.0.14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
+ vchrome-0.0.14.dist-info/top_level.txt,sha256=IYbkbnFb2FGoroYj_ZXIitmnJDgYBA29_HmK9BdEUkY,10
6
+ vchrome-0.0.14.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- v/__init__.py,sha256=7sbAHSk_EElMBcJeHVoXGMmt9bqmci36NWFVRk1sUn4,21
2
- vchrome/__init__.py,sha256=_0kCGTstF2x741a6286sP1Bm0Q-1Zim-bWO0AWzymIE,214865
3
- vchrome-0.0.13.dist-info/METADATA,sha256=H8yukVgwE59eeMe_MVezAemKQUJlXBRWz4HfRUaNl00,55
4
- vchrome-0.0.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
- vchrome-0.0.13.dist-info/top_level.txt,sha256=IYbkbnFb2FGoroYj_ZXIitmnJDgYBA29_HmK9BdEUkY,10
6
- vchrome-0.0.13.dist-info/RECORD,,