奇怪的 json 值 urllib python
Weird json value urllib python
我正在尝试从该站点操纵动态 JSON:
http://esaj.tjsc.jus.br/cposgtj/imagemCaptcha.do
它有 3 个元素,imagem
,一个 base64,labelValorCaptcha
,只是一条消息,uuidCaptcha
,一个通过参数传递的值,用于在此 link 如下:
http://esaj.tjsc.jus.br/cposgtj/somCaptcha.do?timestamp=1455996420264&uuidCaptcha=sajcaptcha_e7b072e1fce5493cbdc46c9e4738ab8a
当我通过浏览器进入第一个站点并在第二个 link 等于 ("..uuidCaptcha=") 之后的 uuidCaptha 时,声音播放正常。我写了一个简单的代码来捕获这些元素。
import urllib, json
url = "http://esaj.tjsc.jus.br/cposgtj/imagemCaptcha.do"
response = urllib.urlopen(url)
data = json.loads(response.read())
urlSound = "http://esaj.tjsc.jus.br/cposgtj/somCaptcha.do?timestamp=1455996420264&uuidCaptcha="
print urlSound + data['uuidCaptcha']
但我不知道发生了什么,uuidCaptcha
的捕获值不起作用。打开错误网页。
有人知道吗?
谢谢!
对我有用。
$ cat a.py
#!/usr/bin/env python
# encoding: utf-8
import urllib, json
url = "http://esaj.tjsc.jus.br/cposgtj/imagemCaptcha.do"
response = urllib.urlopen(url)
data = json.loads(response.read())
urlSound = "http://esaj.tjsc.jus.br/cposgtj/somCaptcha.do?timestamp=1455996420264&uuidCaptcha="
print urlSound + data['uuidCaptcha']
$ python a.py
http://esaj.tjsc.jus.br/cposgtj/somCaptcha.do?timestamp=1455996420264&uuidCaptcha=sajcaptcha_efc8d4bc3bdb428eab8370c4e04ab42c
正如我所说@Charlie Harding,最好的方法是下载页面并获取 JSON 值,因为这个 JSON 是动态的,需要打开的网络 link 才能存在.
更多信息here。
我正在尝试从该站点操纵动态 JSON:
http://esaj.tjsc.jus.br/cposgtj/imagemCaptcha.do
它有 3 个元素,imagem
,一个 base64,labelValorCaptcha
,只是一条消息,uuidCaptcha
,一个通过参数传递的值,用于在此 link 如下:
http://esaj.tjsc.jus.br/cposgtj/somCaptcha.do?timestamp=1455996420264&uuidCaptcha=sajcaptcha_e7b072e1fce5493cbdc46c9e4738ab8a
当我通过浏览器进入第一个站点并在第二个 link 等于 ("..uuidCaptcha=") 之后的 uuidCaptha 时,声音播放正常。我写了一个简单的代码来捕获这些元素。
import urllib, json
url = "http://esaj.tjsc.jus.br/cposgtj/imagemCaptcha.do"
response = urllib.urlopen(url)
data = json.loads(response.read())
urlSound = "http://esaj.tjsc.jus.br/cposgtj/somCaptcha.do?timestamp=1455996420264&uuidCaptcha="
print urlSound + data['uuidCaptcha']
但我不知道发生了什么,uuidCaptcha
的捕获值不起作用。打开错误网页。
有人知道吗? 谢谢!
对我有用。
$ cat a.py
#!/usr/bin/env python
# encoding: utf-8
import urllib, json
url = "http://esaj.tjsc.jus.br/cposgtj/imagemCaptcha.do"
response = urllib.urlopen(url)
data = json.loads(response.read())
urlSound = "http://esaj.tjsc.jus.br/cposgtj/somCaptcha.do?timestamp=1455996420264&uuidCaptcha="
print urlSound + data['uuidCaptcha']
$ python a.py
http://esaj.tjsc.jus.br/cposgtj/somCaptcha.do?timestamp=1455996420264&uuidCaptcha=sajcaptcha_efc8d4bc3bdb428eab8370c4e04ab42c
正如我所说@Charlie Harding,最好的方法是下载页面并获取 JSON 值,因为这个 JSON 是动态的,需要打开的网络 link 才能存在.
更多信息here。