Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于批量下载上海证券交易所上市公司年报的shreport代码包 #1

Open
Cliobuff opened this issue Jun 17, 2020 · 1 comment

Comments

@Cliobuff
Copy link

大邓博士您好!

希望您和您的家人在这段时间安好!

我是康奈尔大学的管理学博士,和您专业类似。但是不同的是您是Python专家(follow了您的GitHub主页,尤其是您的https://github.com/thunderhit/shreport是我学习的重要源泉),我属于小白一类的。看了您的BiliBili以及其他的推荐视频,获益匪浅。

但是我在运行您的数据的时候遇到了三个问题,不知道可不可以请教一下您:
1、第一个问题是使用您给的sh.py的时候,出现了:
Warning (from warnings module):
File "C:\Users\qiaok\AppData\Local\Programs\Python\Python38-32\lib\site-packages\grequests.py", line 22
curious_george.patch_all(thread=False, select=False)
MonkeyPatchWarning: Monkey-patching ssl after ssl has already been imported may lead to errors, including RecursionError on Python 3.6. It may also silently lead to incorrect behaviour on Python 3.7. Please monkey-patch earlier. See gevent/gevent#1016. Modules that had direct imports (NOT patched): ['urllib3.util (C:\Users\qiaok\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3-1.25.9-py3.8.egg\urllib3\util\init.py)', 'urllib3.util.ssl_ (C:\Users\qiaok\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3-1.25.9-py3.8.egg\urllib3\util\ssl_.py)'].

这个是不是因为我的版本问题,不知道如何解决。(那个Github的答案太多了,让我有点手足无措)
不知道您能不能为我指点迷津?
2、我尝试了您给的下载某上市公司年报.py,同样的问题再次出现,并且有如下的反应:
准备获取600000年报文件链接
Traceback (most recent call last):
File "D:\Screenscript\shreport-master\test\下载某上市公司年报.py", line 10, in
sh.download(code='600000', savepath=cwd)
File "C:\Users\qiaok\AppData\Local\Programs\Python\Python38-32\lib\site-packages\shreport\sh.py", line 139, in download
urls = self.pdfurls(code=code)
File "C:\Users\qiaok\AppData\Local\Programs\Python\Python38-32\lib\site-packages\shreport\sh.py", line 109, in pdfurls
resp = requests.get(url, headers=headers, cookies=self.cookies)
File "C:\Users\qiaok\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests-2.23.0-py3.8.egg\requests\api.py", line 76, in get
return request('get', url, params=params, **kwargs)
File "C:\Users\qiaok\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests-2.23.0-py3.8.egg\requests\api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\qiaok\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests-2.23.0-py3.8.egg\requests\sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\qiaok\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests-2.23.0-py3.8.egg\requests\sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "C:\Users\qiaok\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests-2.23.0-py3.8.egg\requests\adapters.py", line 439, in send
resp = conn.urlopen(
File "C:\Users\qiaok\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3-1.25.9-py3.8.egg\urllib3\connectionpool.py", line 670, in urlopen
httplib_response = self._make_request(
File "C:\Users\qiaok\AppData\Local\Programs\Python\Python38-32\lib\site-packages\urllib3-1.25.9-py3.8.egg\urllib3\connectionpool.py", line 392, in _make_request
conn.request(method, url, **httplib_request_kw)
File "C:\Users\qiaok\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 1240, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\Users\qiaok\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 1281, in _send_request
self.putheader(hdr, value)
File "C:\Users\qiaok\AppData\Local\Programs\Python\Python38-32\lib\http\client.py", line 1213, in putheader
values[i] = one_value.encode('latin-1')
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 7-8: ordinal not in range(256)
Stackflow 上有一些回答,但是好像不是很有用。
3、最后,一个不是特不重要的,是在运行您的setup到时候,这个 unicode的问题再次出现,估计是不是我需要安装摸一个包?
Traceback (most recent call last):

File "D:\Screenscript\shreport-master\setup.py", line 15, in
long_description=open('README.md').read(), # 读取的Readme文档内容
UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 5: illegal multibyte sequence

谢谢您!还望您不吝赐教!

@hiDaDeng
Copy link
Owner

hiDaDeng commented Jun 18, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants