{
"info": {
"author": "Steve Pulec",
"author_email": "spulec@gmail",
"bugtrack_url": null,
"classifiers": [],
"description": "Zester\n=========================\n\nZester is a library that makes it easier to develop Python clients for websites without APIs.\n\nNo lxml, no XPath, just javascript.\n\nLet's make a client library for `Hacker News `_ by saving the following code in a file named hnclient.py::\n\n from zester import MultipleClient, Attribute\n\n class HNClient(MultipleClient):\n url = \"http://news.ycombinator.com/\"\n title = Attribute(selector=\"$('.title a')\", modifier=\"$(el).html()\")\n link = Attribute(selector=\"$('.title a')\"), modifier=\"$(el).attr('href')\")\n points = Attribute(selector=\"$('.subtext span')\", modifier=\"$(el).html().replace(' points', '')\")\n\nNow, let's use the client we just made. Open a python shell::\n\n >>> from hnclient import HNClient\n >>> client = HNClient()\n >>> stories = client.process()\n >>> stories[0]\n HNClientResponse(points=u'200', link=u'http://daltoncaldwell.com/what-twitter-could-have-been', title=u'What Twitter could have been')\n >>> print stories[0].title\n What Twitter could have been\n >>> print stories[0].link\n http://daltoncaldwell.com/what-twitter-could-have-been\n >>> print stories[0].points\n 56\n\nWe subclassed MultipleClient there because we were planning on returning multiple results. If we wanted to make a client for something like `Weather.gov `_ that returned a single result, we could do something like this::\n\n from zester import SingleClient, Attribute\n\n class WeatherClient(SingleClient):\n url = \"http://forecast.weather.gov/MapClick.php?lat={lat}&lon={lng}\"\n temperature = Attribute(selector=\"$('.myforecast-current-lrg').html()\")\n humidity = Attribute(selector=\"$('.current-conditions-detail li').contents()[1]\")\n heat_index = Attribute(selector=\"$('.current-conditions-detail li').contents()[11]\")\n\n def __init__(self, lat, lng, *args, **kwargs):\n super(WeatherClient, self).__init__(*args, **kwargs)\n self.url = self.url.format(lat=lat, lng=lng)\n\nThis also demonstrates how you can allow arguments to be taken::\n\n >>> from weather_client import WeatherClient\n >>> client = WeatherClient(lat=40.7143528, lng=-74.0059731)\n >>> curr_weather = client.process()\n >>> curr_weather\n WeatherClientResponse(heat_index=u'82\\xb0F (28\\xb0C)', temperature=u'80\\xb0F', humidity=u'58%')\n >>> print curr_weather.temperature\n 80\u00b0F\n >>> print curr_weather.humidity\n 58%\n >>> print curr_weather.heat_index\n 82\u00b0F (28\u00b0C)\n\n\nInstallation\n------------\n\nZester is dependant upon `Ghost.py `_. You must install it before installing Zester. Ghost.py will also require the installation of either PyQt or PySide.\n\nAfter Ghost.py is installed, to install zester: ::\n\n $ pip install zester\n",
"description_content_type": null,
"docs_url": null,
"download_url": "UNKNOWN",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/spulec/zester",
"keywords": null,
"license": "UNKNOWN",
"maintainer": null,
"maintainer_email": null,
"name": "zester",
"package_url": "https://pypi.org/project/zester/",
"platform": "UNKNOWN",
"project_url": "https://pypi.org/project/zester/",
"project_urls": {
"Download": "UNKNOWN",
"Homepage": "https://github.com/spulec/zester"
},
"release_url": "https://pypi.org/project/zester/0.0.3/",
"requires_dist": null,
"requires_python": null,
"summary": "Easier Python client libraries",
"version": "0.0.3"
},
"last_serial": 802260,
"releases": {
"0.0.1": [
{
"comment_text": "",
"digests": {
"md5": "e0dfa14c3291c16a4c5c5dcb636f28aa",
"sha256": "1a0ca5777c6115bc7088f23aa346b2bb5b7b12e6740fdbcd1fbe114e0f4fc231"
},
"downloads": -1,
"filename": "zester-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "e0dfa14c3291c16a4c5c5dcb636f28aa",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3120,
"upload_time": "2012-07-07T23:46:18",
"url": "https://files.pythonhosted.org/packages/32/70/28efce3d1f1c4f30932b64f804fb23cf0295a962499475ef27265fe9645f/zester-0.0.1.tar.gz"
}
],
"0.0.2": [
{
"comment_text": "",
"digests": {
"md5": "18608b7d585f0b9b7f6fbb926cf06927",
"sha256": "0867878b756c84a2bf6d07eff58374111fd82e95128f1c4225fe1e01fac79aad"
},
"downloads": -1,
"filename": "zester-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "18608b7d585f0b9b7f6fbb926cf06927",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3120,
"upload_time": "2012-07-07T23:47:28",
"url": "https://files.pythonhosted.org/packages/7b/1d/4f4f5a8613a0a697d5b0d12658b3d0fb6303226f0f08b70f2f788c3ee1e6/zester-0.0.2.tar.gz"
}
],
"0.0.3": [
{
"comment_text": "",
"digests": {
"md5": "f58505c1936fc5457fd420e0aa553145",
"sha256": "e1fc539ab9f0908440fbbaf6fd44961d5d770373ebd66e9597ef5417ee683b09"
},
"downloads": -1,
"filename": "zester-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "f58505c1936fc5457fd420e0aa553145",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3193,
"upload_time": "2012-07-07T23:54:22",
"url": "https://files.pythonhosted.org/packages/5b/b2/9f50c7ac13ee895399e2663ece2991ad6cd30edc3ba9ac371aee28b528dc/zester-0.0.3.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "f58505c1936fc5457fd420e0aa553145",
"sha256": "e1fc539ab9f0908440fbbaf6fd44961d5d770373ebd66e9597ef5417ee683b09"
},
"downloads": -1,
"filename": "zester-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "f58505c1936fc5457fd420e0aa553145",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3193,
"upload_time": "2012-07-07T23:54:22",
"url": "https://files.pythonhosted.org/packages/5b/b2/9f50c7ac13ee895399e2663ece2991ad6cd30edc3ba9ac371aee28b528dc/zester-0.0.3.tar.gz"
}
]
}