import ullib2
PEOPLEurl = 'http://yourcompany.highrisehq.com/people.xml' #get all the people
# or
COMPANYurl = 'http://yourcompany.highrisehq.com/company.xml' #get all companies
token = '12345abcd' #your token
password = 'X'
passmanager = urllib2.HTTPPasswordMgrWithDefaultRealm()
passmanager.add_password(None, PEOPLEurl, token, password)
authhandler = urllib2.HTTPBasicAuthHandler(passmanager)
opener = urllib2.build_opener(authhandler)
urllib2.install_opener(opener)
page = urllib2.urlopen(PEOPLEurl).read()
print page #this will dump out all the people contacts in highrise
我正忙着解决这个问题,突然碰到你的问题。这是我迄今为止所破解的。虽然还不漂亮,但很管用。我不认识Pycurl,看了一会儿之后,我回到了urllib2。Highrise使用基本身份验证,所以不必使用CURL,可以使用urllib2。你只需要完成所有的程序管理器步骤。输出是一个很长的XML文件,其中包含所有公司或人员,具体取决于插入的URL。如果你只需要一个人,你可以做一些类似“http……/people/123.xml”或“http……/people/123 fname”之类的东西-名称.xml'(就像您在url中看到的,当您实际访问highrise中的联系人时,添加了.xml)。在
任何关于这个代码的反馈或建议都会很有帮助!在
我为Python编写了一个高层API包装器。它为每个高层类使用Python对象,工作方式与Django ORM非常相似:
您可以从GitHub获取源代码:https://github.com/feedmagnet/pyrise
或者从PyPI安装:
^{pr2}$请参阅here了解如何进行基本身份验证。IIRC urllib还支持
http://user:password@example.com
url。在相关问题 更多 >
编程相关推荐