-
Notifications
You must be signed in to change notification settings - Fork 3
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
🐙🐶技术讨论区 #9
Comments
20151209 @bambooom
|
GitHub API 学习笔记by @hysic 我先抛砖引玉~
获取 commit 数
import requests
url = "https://api.github.com/repos/Octopuppy/Octodog/stats/contributors"
r = requests.get(url)
# r.json() 返回所有的 contributors
for person in r.json():
# person 类型为 dict, keys有 "author", "total", "weeks"
# "author"的 value 又是一个 dict, "login" 对应的是作者的名字
print person["author"]["login"] + ":" + str(person["total"])
_这个结果只给出了 master 分支的 commit 数, 并没有考虑 pull requests 的数目, 这个数目与 pulse 页面给出的数目相同. 我理想的数据就是 pulse 页面柱状图中的commit 数.(_待解决*) 获取(首页显示的)commit 数import requests
url = "https://api.github.com/repos/Octopuppy/Octodog/commits"
r = requests.get(url).json()
print len(r)
获取仓库的 star/watch/fork 数目import requests
url = "https://api.github.com/repos/Octopuppy/Octodog"
r = requests.get(url).json()
print "Octodog repo has been stared by %d times, watched by %d times, and forked by %d times." % (r["stargazers_count"], r["watchers_count"], r["forks_count"])
其他
|
部署代码到sae遇到问题 - 第三方包
import sys, errno
_names = sys.builtin_module_names
...
if 'posix' in _names:
name = 'posix'
linesep = '\n'
from posix import *
try:
from posix import _exit
except ImportError:
pass
import posixpath as path
import posix
__all__.extend(_get_exports_list(posix))
del posix
elif 'nt' in _names:
name = 'nt'
linesep = '\r\n'
from nt import *
try:
from nt import _exit
except ImportError:
pass
import ntpath as path
import nt
__all__.extend(_get_exports_list(nt))
del nt
20151216
|
sae 貌似不支持I/O读写,我估计os模块触动了I/O读写,所以就不能用了 |
@junjielizero 嗯差不多是这样~我尝试了修改第三方库里的代码 直接把 |
@bambooom 那不能将本地东西上传到网上某个地方吗? |
@junjielizero 不行呐,不是我本地有的东西,是第三方包自己跑的时候相当于缓存之类的东西吧?这个还不太确定 |
@bambooom 试都没试过怎么知道是否可用?! |
@ZoomQuiet 好的,我再试试,以及睡之前已发邮件咨询sae官方。。。:joy: |
@junjielizero 突然有点没理解,你说的把本地什么东西上传到网上某个地方? |
@bambooom I/O读写应该涉及读取本地文档之类的东西,将本地文档放到网上,读取是网上的东西,估计能绕过I/O问题 |
@junjielizero 但是我理解这个是这样的,是第三方包需要读写临时文件,不是我写的里面需要读写,我最多找到 这里 写的
所以我觉得修改第三方包里的代码换成使用StringIO来读写临时文件比较靠谱。。。 |
我发现自己简直太蠢了...............................................................orz
总结: 认真看每条Traceback, 想想Traceback之间的逻辑关系, 是否真的有错误, 是否可以避开先 |
如何提升访问速度
|
2015-12-17 9:50 GMT+08:00 Bamboo = 竹子 [email protected]:
Life's Pathetic, Let's Pythonic! 人生苦短, Python是岸! |
@ZoomQuiet 不明白该怎么判断慢的原因在哪里。。。大妈可否再给点hint~ |
问题索引
The text was updated successfully, but these errors were encountered: