{ "info": { "author": "Patrick J. Ryan", "author_email": "pjryan126@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "\"opyncorporates\"\n\n![](https://travis-ci.com/pjryan126/opyncorporates.svg?branch=master) \n[![Total alerts](https://img.shields.io/lgtm/alerts/g/pjryan126/opyncorporates.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/pjryan126/opyncorporates/alerts/) \n[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/pjryan126/opyncorporates.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/pjryan126/opyncorporates/context:python)\n\n# Overview\n\n`opyncorporates` is a Python wrapper for the [OpenCorporates API](https://api.opencorporates.com).\nIt allows a user to create an `Engine` object that interacts with the API \nthrough two simple methods: `search` and `fetch`.\n\nThe `search` and `fetch` methods use signatures that mimic the request \narguments and variables required in the GET requests through the \n[OpenCorporates API](https://api.opencorporates.com), \nwhile eliminating some of the cruft.\n\nFor example, a request to search for a company by name through the \n[OpenCorporates API](https://api.opencorporates.com) \nmight look something like this:\n\n`GET https://api.opencorporates.com/v0.4/companies/search?q=bar&per_page=100`\n\nSubmitting the same request through the search method of of an opyncorporates \nEngine object, on the other hand, would look like this:\n\n```\n>>> from opyncorporates import create_engine\n>>> engine = create_engine(api_version='0.4')\n>>> search = engine.search('companies', q='bar', per_page=100)\n```\n\nBoth the `search` and `fetch` methods return `opyncorporates.Request` objects,\nwhich allow the user (1) to explore information related to a request and (2) to\nobtain results more easily than it would be to craft a series of successive API \ncalls. \n\n# Getting Started\n\nThis section will show you how to get up and running with the \n`opyncorporates` package. Additional information can be found in the \ndocumentation [here](https://opyncorporates.readthedocs.io/en/latest/).\n\nTo get started, you can install the package using ``pip``:\n\n```\n$ pip install opyncorporates\n```\n\nOnce the package is installed, you can use it to create an\n`Engine` object for submitting requests and retrieving data through the \nOpenCorporates API. When creating an `Engine` object, you have the option of \nspecifying an API version and an API token:\n\n ```\n>>> from opyncorporates import create_engine\n>>> engine = create_engine(api_version='0.4',\n... api_token='')\n>>> engine.api_version\n'0.4'\n```\n\nThe API version and API token will be used when building the urls required to\nsubmit requests to the [OpenCorporates API](https://api.opencorporates.com). \nAs of now, the package's default API version is 0.4, and it is the only \nversion supported. If you are planning to query the API on a regular basis, I\nhighly recommend purchasing an API token to increase your call limits.\n\nOnce you have created an `Engine` object, you\ncan start making calls to the [OpenCorporates API](https://api.opencorporates.com). \nIn general, each of your API calls will perform only one of two actions. It \nwill either:\n\n1. **search** for potential matches to a specified string value, or\n2. **fetch** a specific object by its unique identifier\n\nThere is a third action available when seeking information about a particular\nobject using an imprecise identifier. This third action allows you to **match**\nto an object by providing a string value for that object's name.\n\nFinally, if none of these actions suit your purposes, you can make a generic\n**request** to the API and parse the response yourself.\n\nThe call signatures for the methods associated with each action mimic HTTPS\ncalls to the API. Http request args are \nsubmitted to the method as positional arguments, while request variables are \nsubmitted as keyword arguments.\n\nFurther explanation of the search, fetch, match, and request actions can be\nfound below.\n\nSearch\n------\n\nYour `Engine` object implements searches through the `search` method, which\nreturns a `SearchRequest` object:\n\n```\n>>> from opyncorporates import create_engine\n>>> engine = create_engine(api_version='0.4')\n>>> search = engine.search('companies', 'search', q='Google')\n>>> search.url\n'https://api.opencorporates.com/v0.4/companies/search?q=google'\n>>> search.responses # a history of responses for the object\n[]\n>>> search.response # the most recent response for this request\n\n>>> search.total_pages\n26\n>>> search.per_page\n30\n>>> search.total_count\n764\n```\n\nYou can then use the properties of this `SearchRequest` object to return as \nmuch or as little information from the OpenCorporates database as you need. \nFor example, if you want to retrieve only the first page of search results \nfrom the [OpenCorporates API](https://api.opencorporates.com):\n\n```\n>>> first_page = search.get_page(1)\n>>> print(type(first_page))\n\n>>> print(len(first_page))\n30\n>>> print(type(first_page[0]))\n\n```\n\nFetch\n-----\n\nThe `fetch` method implements the second available action. This method allows\n a user to retrieve a specific item from the OpenCorporates API by providing \n the item's type and unique identifier. For example, a user can retrieve a \n specific company from the [OpenCorporates API](https://api.opencorporates.com)\n by providing its item type (*i.e.*, 'company' or 'companies') and its unique\n identifier, which is the company's two-character country code plus its \n company number unique to that jurisdiction:\n\n```\n>>> from opyncorporates import create_engine\n>>> engine = create_engine(api_version='0.4')\n>>> fetch = engine.fetch('companies', 'gb', '00102498')\n>>> fetch.responses # a history of responses for the object\n[]\n>>> fetch.response # the most recent response for this request\n\n>>> fetch.results['name']\n'BP P.L.C.'\n>>> fetch.results['incorporation_date']\n'1909-04-14'\n```\n\nIf the fetch action is successful, the item is stored as a dict in the\n`FetchRequest` object's `results` attribute.\n\nMatch\n-----\n\nThe `match` method implements the third available action. It allows a user to\n match a specified string value to a single item in the [OpenCorporates](https://opencorporates.com) \n database. As of version 0.4, the [OpenCorporates API](https://api.opencorporates.com) exposes this action to \n match jurisdictions only:\n\n```\n>>> from opyncorporates import create_engine\n>>> engine = create_engine()\n>>> match = engine.match('jurisdictions', q='U.K.')\n```\n\nRequest\n-------\n\nThe `request` method implements a generic request action. It allows a user to\n submit a request by supplying either (1) a string for the request args \n and/or vars or (2) the request arguments and variables as positional and \n keyword parameters. The engine will build a clean url for your request.\n\n For example, the same request for a search of company records can be written\n in any of the following ways:\n\n```\n>>> from opyncorporates import create_engine\n>>> engine = create_engine()\n>>> r1 = engine.request('companies/gb/00102498/search?q=google')\n>>> r2 = engine.request('/companies/gb/00102498/search',\n... q='Google')\n>>> r3 = engine.request('companies', 'gb', '00102498', 'search'\n... q='google')\n>>> r1.url == r2.url == r3.url # confirm all urls are the same\nTrue\n```\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://opyncorporates.readthedocs.io/en/latest/", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "opyncorporates", "package_url": "https://pypi.org/project/opyncorporates/", "platform": "", "project_url": "https://pypi.org/project/opyncorporates/", "project_urls": { "Homepage": "https://opyncorporates.readthedocs.io/en/latest/" }, "release_url": "https://pypi.org/project/opyncorporates/0.1.0/", "requires_dist": [ "requests" ], "requires_python": "", "summary": "a Python package for calling the OpenCorporates API", "version": "0.1.0" }, "last_serial": 4812713, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "67f02a4b14ec423c4274c03e85beef21", "sha256": "daaf8005fc949f80535bd26f1cac73bac3e6195d06d33e0fe9a8e1a3ddc55368" }, "downloads": -1, "filename": "opyncorporates-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "67f02a4b14ec423c4274c03e85beef21", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9591, "upload_time": "2019-02-12T19:44:01", "url": "https://files.pythonhosted.org/packages/a4/cf/d95f491430701c632c16dc0926a76882545f74d47af315766264fffd243a/opyncorporates-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2ca304d598092c00ff5c31d32b0e5bf1", "sha256": "4ff048193c54098558e5131965a252a8af471e34fe5b8eb4ecd0f284aef03ffa" }, "downloads": -1, "filename": "OpynCorporates-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "2ca304d598092c00ff5c31d32b0e5bf1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9595, "upload_time": "2019-02-12T19:44:03", "url": "https://files.pythonhosted.org/packages/75/ac/66eb56b382a9b92b15f00be64d4cbc7d61ed5c0667156e468c5914f5d801/OpynCorporates-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cf17e38b2ee7630fadf97a5768a42f88", "sha256": "b0e8a7cfb35bd53509d2e30608a7a77373aa2c23ab98e273dbe924853a15eda8" }, "downloads": -1, "filename": "opyncorporates-0.0.1.tar.gz", "has_sig": false, "md5_digest": "cf17e38b2ee7630fadf97a5768a42f88", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8922, "upload_time": "2019-02-12T19:44:09", "url": "https://files.pythonhosted.org/packages/7c/41/d9dab2bc0ae88959f0d7af8d9b9e22671eecc22b32d7ed6d5fe0cc919567/opyncorporates-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "baae54f7b649cd04de6f874d8ff31b01", "sha256": "7cc7c2c4983fb69fec1dd08640e427cf939295566fb356f501a15914cc5d5f8c" }, "downloads": -1, "filename": "opyncorporates-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "baae54f7b649cd04de6f874d8ff31b01", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9565, "upload_time": "2019-02-12T19:44:05", "url": "https://files.pythonhosted.org/packages/44/f0/95cc729d82041cc3e31be193a332d58889ba7b9501b7edcc6d112ee04a7f/opyncorporates-0.0.2-py3-none-any.whl" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "6c1acf4a2a3300a5fb76cc466586dcfc", "sha256": "37b7dd773334f47db804138a103467b0ba536888869bf7ba999ccf2fa3f30fc7" }, "downloads": -1, "filename": "opyncorporates-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "6c1acf4a2a3300a5fb76cc466586dcfc", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9566, "upload_time": "2019-02-12T19:44:06", "url": "https://files.pythonhosted.org/packages/60/e1/fac661f94d0e48a000f671c4db5c7d3fcfd5d11b8fe9f218e062fea44655/opyncorporates-0.0.3-py3-none-any.whl" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "7f508ac91b4d8f58c68e144b038db655", "sha256": "25f13b70d463743c363a5d1eb7305ddf16e42eacf1cfd93dafafee5a9455aeb6" }, "downloads": -1, "filename": "opyncorporates-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "7f508ac91b4d8f58c68e144b038db655", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9559, "upload_time": "2019-02-12T19:44:07", "url": "https://files.pythonhosted.org/packages/28/2d/e9086aebadea4a6d6f99d47cab2a76b47485620dfa4d1fb138dcb8daef5c/opyncorporates-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0c919f5d4cacc5864fa3b9979f88f25f", "sha256": "481a3250fdc55df922a69b9ba36fa4d63c98463b1a3b7e48b79c69582956cce7" }, "downloads": -1, "filename": "opyncorporates-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "0c919f5d4cacc5864fa3b9979f88f25f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9571, "upload_time": "2019-02-12T19:44:08", "url": "https://files.pythonhosted.org/packages/92/12/a386c75162c37f9600dac283249cf48436a1c4c3d84c089a5fabb98ce0a1/opyncorporates-0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ff023e622cfd3cbb54db41ce1d5b1740", "sha256": "12a2cdf0201d9c2689549912f396cebf93c4cd229dd127fa05bc9b25f26885b2" }, "downloads": -1, "filename": "opyncorporates-0.1.tar.gz", "has_sig": false, "md5_digest": "ff023e622cfd3cbb54db41ce1d5b1740", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8837, "upload_time": "2019-02-12T20:44:25", "url": "https://files.pythonhosted.org/packages/cf/ce/9a141a499641ba27ddff195a1926555d4fc060a0bf5c9a57c2c3f30b26a5/opyncorporates-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7f508ac91b4d8f58c68e144b038db655", "sha256": "25f13b70d463743c363a5d1eb7305ddf16e42eacf1cfd93dafafee5a9455aeb6" }, "downloads": -1, "filename": "opyncorporates-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "7f508ac91b4d8f58c68e144b038db655", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9559, "upload_time": "2019-02-12T19:44:07", "url": "https://files.pythonhosted.org/packages/28/2d/e9086aebadea4a6d6f99d47cab2a76b47485620dfa4d1fb138dcb8daef5c/opyncorporates-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0c919f5d4cacc5864fa3b9979f88f25f", "sha256": "481a3250fdc55df922a69b9ba36fa4d63c98463b1a3b7e48b79c69582956cce7" }, "downloads": -1, "filename": "opyncorporates-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "0c919f5d4cacc5864fa3b9979f88f25f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9571, "upload_time": "2019-02-12T19:44:08", "url": "https://files.pythonhosted.org/packages/92/12/a386c75162c37f9600dac283249cf48436a1c4c3d84c089a5fabb98ce0a1/opyncorporates-0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ff023e622cfd3cbb54db41ce1d5b1740", "sha256": "12a2cdf0201d9c2689549912f396cebf93c4cd229dd127fa05bc9b25f26885b2" }, "downloads": -1, "filename": "opyncorporates-0.1.tar.gz", "has_sig": false, "md5_digest": "ff023e622cfd3cbb54db41ce1d5b1740", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8837, "upload_time": "2019-02-12T20:44:25", "url": "https://files.pythonhosted.org/packages/cf/ce/9a141a499641ba27ddff195a1926555d4fc060a0bf5c9a57c2c3f30b26a5/opyncorporates-0.1.tar.gz" } ] }