pyinsee


Namepyinsee JSON
Version 0.1.2 PyPI version JSON
download
home_pageNone
SummaryA package for collecting and processing company data from INSEE API
upload_time2024-11-29 15:06:01
maintainerNone
docs_urlNone
authorAyman KUMA
requires_python>=3.8
licenseApache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
keywords insee api company data
VCS
bugtrack_url
requirements certifi charset-normalizer colorama idna python-dotenv requests tqdm urllib3
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
<img src="static\img\Insee_logo.png" alt="Logo" height="100">


# Pyinsee - insee API Client

The Insee Client package is a Python library that provides a simple and easy-to-use interface for interacting with the Insee API. It allows you to retrieve legal data, such as company information, and save it to a dataset.



## Installation

To install the Insee Client package, run the following command:

```shell
  pip install pyinsee
```

Or 

```shell
  pip install git+https://github.com/AymanKUMA/insee-client.git 
```


## Initial usage

To run this project, you will need to add the following environment variables to your .env file.

The Insee Client package provides a command-line interface (CLI) for setting up environment variables. You can use the CLI by running the following command:

```shell
setup-cli --help
```
Output:
```


    ██████╗ ██╗   ██╗██╗███╗   ██╗███████╗███████╗███████╗
    ██╔══██╗╚██╗ ██╔╝██║████╗  ██║██╔════╝██╔════╝██╔════╝
    ██████╔╝ ╚████╔╝ ██║██╔██╗ ██║███████╗█████╗  █████╗
    ██╔═══╝   ╚██╔╝  ██║██║╚██╗██║╚════██║██╔══╝  ██╔══╝
    ██║        ██║   ██║██║ ╚████║███████║███████╗███████╗
    ╚═╝        ╚═╝   ╚═╝╚═╝  ╚═══╝╚══════╝╚══════╝╚══════╝
     ...  .    .     |    pyinsee v0.1.0
    :     :    :     |    github.com/AymanKUMA/insee-client
     '''  '''' '     |    Welcome to the .env setup CLI!
    ------------------------------------------------------


usage: py-insee-setup [-h] [--env-path ENV_PATH] --data-dir DATA_DIR [--client-key CLIENT_KEY] [--client-secret CLIENT_SECRET] [--api-key API_KEY] [--api-url API_URL] [--overwrite]

Set up the .env file for the application.

options:
  -h, --help            show this help message and exit
  --env-path ENV_PATH   Path to the .env file.
  --data-dir DATA_DIR   Path to the data directory.
  --client-key CLIENT_KEY
                        client key for the API.
  --client-secret CLIENT_SECRET
                        client secret for the API.
  --api-key API_KEY     API key for the API, set it up only in case the OAuth flow doesn't work.
  --api-url API_URL     API base URL.
  --overwrite           Overwrite the existing .env file.
```

Note that the .env file will be created automatically via the CLI. 

You will be prompted to provide the following values:

* Data output directory (default: data)
* Insee API consumer key
* Insee API consumer secret
* API URL (default: https://api.insee.fr/api-sirene/3.11/)

If a .env file already exists at the specified path, you will be asked if you want to update the file.

Once the environment variables are available you can start using the insee-cli or the python module.




## Usage/Examples

### Insee CLI

Using py-insee cli you can either retrive bulk data, or a single data either by "*siren*" or "*siret*": 
```
usage: py-insee  [-h] {insee_get_bulk,insee_get_by_number} ...

CLI for querying INSEE data.

positional arguments:
  {insee_get_bulk,insee_get_by_number}
    insee_get_bulk      Fetch bulk data from INSEE API
    insee_get_by_number
                        Fetch legal data by number

options:
  -h, --help            show this help message and exit
```

The first option is getting bulk data: 
```
usage: py-insee  insee_get_bulk [-h] [--q Q] [--date DATE] [--curse
CURSEUR] [--debut DEBUT] [--nombre NOMBRE] [--tri [TRI ...]] [--cham
[CHAMPS ...]] [--facette [FACETTE ...]] [--mvn MVN] [--save SAVE]
                                
                                {siren,siret} {json,csv}

positional arguments:
  {siren,siret}         Type of data to retrieve
  {json,csv}            Content type of the response

options:
  -h, --help            show this help message and exit
  --q Q                 Query parameter
  --date DATE           Date parameter (YYYY-MM-DD)
  --curseur CURSEUR     Cursor parameter (start value = *) Then you'll get the next cursor in the response
  --debut DEBUT         Start date or number
  --nombre NOMBRE       Number of items
  --tri [TRI ...]       Sorting criteria
  --champs [CHAMPS ...]
                        Fields to retrieve
  --facette [FACETTE ...]
                        Facette fields
  --mvn MVN             Hide null values (true/false)
  --save SAVE           Save data to a file

```

The first option is getting data by number:

```
usage: py-insee insee_get_by_number [-h] [--date DATE] [--champs [CHAMPS ...]] [--mvn MVN] [--save SAVE] {siren,siret} id_code

positional arguments:
  {siren,siret}         Type of data to retrieve
  id_code               ID code of the company

options:
  -h, --help            show this help message and exit
  --date DATE           Date parameter (YYYY-MM-DD)
  --champs [CHAMPS ...]
                        Fields to retrieve
  --mvn MVN             Hide null values (true/false)
  --save SAVE           Save data to a file
```

If the argument '**save**' is not provided the CLI display the results. Note that the data is saved in the directory *data/raw/...*

### Python usage
Setup the envirement variable via the cli in your project and then import the Client from the pyinsee: 

```python
from pyinsee.insee_client import InseeClient
```

1. **Get data bulk :**
Get bulk data of either siren or siret numbers: 

```
get_bulk(data_type: 'str' = 'siren', **kwargs: 'BulkParams') -> 'dict' method of pyinsee.insee_client.InseeClient instance
    Get bulk data (SIREN or SIRET) from INSEE API.

    Args:
        data_type (str): The type of data to retrieve, either "siren" or "siret".
        **kwargs (dict | None): The query parameters for the API request.
            q: str
            date: str
            curseur: str
            debut: (str, int)
            nombre: (str, int)
            tri: (str, list)
            champs: (str, list)
            facette.champ: (str, list)
            masquerValeursNulles: (str, bool)

    Raises:
        ValueError: If the query parameters are not valid or if `data_type` is not valid.

    Returns:
        dict: The response from the API.
```

**Example** 
```python 
# get bulk
client_bulk = InseeClient()

bulk_data, header = client_bulk.get_bulk(
  data_type="siren",
  nombre = 5,
  date = "2022-01-01",
)
```

2. **Get data by number :**
Get data either by Siren or Siret numbers. 

```
get_by_number(data_type: 'str' = 'siren', id_code: 'str | int | None' = None, **kwargs: 'dict') -> 'dict' method of pyinsee.insee_client.InseeClient instance
    Get legal data from INSEE API for a given sirnen or siret number.

    Args:
        data_type (str): The type of data to retrieve, either "siren" or "siret".
        id_code (str | int): The id_code of the company.
        kwargs (dict | None): The query parameters for the API request.
        date : str                    champs : (str, list)
        masquerValeurNulles: (str, bool)

    Raises:
        ValueError: If the query parameters are not valid or if `data_type` is not valid.

    Returns:
        dict: The legal data for the company.
```

**Example**

```python
# get by number
client_by_number = InseeClient()

siren_data = client_by_number.get_by_number(
    data_type="siren",
    id_code = "000325175",
)
```
### Updates

The API provided by the INSEE has changed and currently I'm trying to use Oauth service to retrieve the API key instead of setting it manually.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyinsee",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "insee, api, company data",
    "author": "Ayman KUMA",
    "author_email": "Ayman KUMA <aymankamel.mail@example.com>",
    "download_url": null,
    "platform": null,
    "description": "\r\n<img src=\"static\\img\\Insee_logo.png\" alt=\"Logo\" height=\"100\">\r\n\r\n\r\n# Pyinsee - insee API Client\r\n\r\nThe Insee Client package is a Python library that provides a simple and easy-to-use interface for interacting with the Insee API. It allows you to retrieve legal data, such as company information, and save it to a dataset.\r\n\r\n\r\n\r\n## Installation\r\n\r\nTo install the Insee Client package, run the following command:\r\n\r\n```shell\r\n  pip install pyinsee\r\n```\r\n\r\nOr \r\n\r\n```shell\r\n  pip install git+https://github.com/AymanKUMA/insee-client.git \r\n```\r\n\r\n\r\n## Initial usage\r\n\r\nTo run this project, you will need to add the following environment variables to your .env file.\r\n\r\nThe Insee Client package provides a command-line interface (CLI) for setting up environment variables. You can use the CLI by running the following command:\r\n\r\n```shell\r\nsetup-cli --help\r\n```\r\nOutput:\r\n```\r\n\r\n\r\n    \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2557\u2588\u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\r\n    \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u255a\u2588\u2588\u2557 \u2588\u2588\u2554\u255d\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\r\n    \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d \u255a\u2588\u2588\u2588\u2588\u2554\u255d \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2588\u2588\u2588\u2557\r\n    \u2588\u2588\u2554\u2550\u2550\u2550\u255d   \u255a\u2588\u2588\u2554\u255d  \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u255a\u2550\u2550\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255d  \u2588\u2588\u2554\u2550\u2550\u255d\r\n    \u2588\u2588\u2551        \u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\r\n    \u255a\u2550\u255d        \u255a\u2550\u255d   \u255a\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\r\n     ...  .    .     |    pyinsee v0.1.0\r\n    :     :    :     |    github.com/AymanKUMA/insee-client\r\n     '''  '''' '     |    Welcome to the .env setup CLI!\r\n    ------------------------------------------------------\r\n\r\n\r\nusage: py-insee-setup [-h] [--env-path ENV_PATH] --data-dir DATA_DIR [--client-key CLIENT_KEY] [--client-secret CLIENT_SECRET] [--api-key API_KEY] [--api-url API_URL] [--overwrite]\r\n\r\nSet up the .env file for the application.\r\n\r\noptions:\r\n  -h, --help            show this help message and exit\r\n  --env-path ENV_PATH   Path to the .env file.\r\n  --data-dir DATA_DIR   Path to the data directory.\r\n  --client-key CLIENT_KEY\r\n                        client key for the API.\r\n  --client-secret CLIENT_SECRET\r\n                        client secret for the API.\r\n  --api-key API_KEY     API key for the API, set it up only in case the OAuth flow doesn't work.\r\n  --api-url API_URL     API base URL.\r\n  --overwrite           Overwrite the existing .env file.\r\n```\r\n\r\nNote that the .env file will be created automatically via the CLI. \r\n\r\nYou will be prompted to provide the following values:\r\n\r\n* Data output directory (default: data)\r\n* Insee API consumer key\r\n* Insee API consumer secret\r\n* API URL (default: https://api.insee.fr/api-sirene/3.11/)\r\n\r\nIf a .env file already exists at the specified path, you will be asked if you want to update the file.\r\n\r\nOnce the environment variables are available you can start using the insee-cli or the python module.\r\n\r\n\r\n\r\n\r\n## Usage/Examples\r\n\r\n### Insee CLI\r\n\r\nUsing py-insee cli you can either retrive bulk data, or a single data either by \"*siren*\" or \"*siret*\": \r\n```\r\nusage: py-insee  [-h] {insee_get_bulk,insee_get_by_number} ...\r\n\r\nCLI for querying INSEE data.\r\n\r\npositional arguments:\r\n  {insee_get_bulk,insee_get_by_number}\r\n    insee_get_bulk      Fetch bulk data from INSEE API\r\n    insee_get_by_number\r\n                        Fetch legal data by number\r\n\r\noptions:\r\n  -h, --help            show this help message and exit\r\n```\r\n\r\nThe first option is getting bulk data: \r\n```\r\nusage: py-insee  insee_get_bulk [-h] [--q Q] [--date DATE] [--curse\r\nCURSEUR] [--debut DEBUT] [--nombre NOMBRE] [--tri [TRI ...]] [--cham\r\n[CHAMPS ...]] [--facette [FACETTE ...]] [--mvn MVN] [--save SAVE]\r\n                                \r\n                                {siren,siret} {json,csv}\r\n\r\npositional arguments:\r\n  {siren,siret}         Type of data to retrieve\r\n  {json,csv}            Content type of the response\r\n\r\noptions:\r\n  -h, --help            show this help message and exit\r\n  --q Q                 Query parameter\r\n  --date DATE           Date parameter (YYYY-MM-DD)\r\n  --curseur CURSEUR     Cursor parameter (start value = *) Then you'll get the next cursor in the response\r\n  --debut DEBUT         Start date or number\r\n  --nombre NOMBRE       Number of items\r\n  --tri [TRI ...]       Sorting criteria\r\n  --champs [CHAMPS ...]\r\n                        Fields to retrieve\r\n  --facette [FACETTE ...]\r\n                        Facette fields\r\n  --mvn MVN             Hide null values (true/false)\r\n  --save SAVE           Save data to a file\r\n\r\n```\r\n\r\nThe first option is getting data by number:\r\n\r\n```\r\nusage: py-insee insee_get_by_number [-h] [--date DATE] [--champs [CHAMPS ...]] [--mvn MVN] [--save SAVE] {siren,siret} id_code\r\n\r\npositional arguments:\r\n  {siren,siret}         Type of data to retrieve\r\n  id_code               ID code of the company\r\n\r\noptions:\r\n  -h, --help            show this help message and exit\r\n  --date DATE           Date parameter (YYYY-MM-DD)\r\n  --champs [CHAMPS ...]\r\n                        Fields to retrieve\r\n  --mvn MVN             Hide null values (true/false)\r\n  --save SAVE           Save data to a file\r\n```\r\n\r\nIf the argument '**save**' is not provided the CLI display the results. Note that the data is saved in the directory *data/raw/...*\r\n\r\n### Python usage\r\nSetup the envirement variable via the cli in your project and then import the Client from the pyinsee: \r\n\r\n```python\r\nfrom pyinsee.insee_client import InseeClient\r\n```\r\n\r\n1. **Get data bulk :**\r\nGet bulk data of either siren or siret numbers: \r\n\r\n```\r\nget_bulk(data_type: 'str' = 'siren', **kwargs: 'BulkParams') -> 'dict' method of pyinsee.insee_client.InseeClient instance\r\n    Get bulk data (SIREN or SIRET) from INSEE API.\r\n\r\n    Args:\r\n        data_type (str): The type of data to retrieve, either \"siren\" or \"siret\".\r\n        **kwargs (dict | None): The query parameters for the API request.\r\n            q: str\r\n            date: str\r\n            curseur: str\r\n            debut: (str, int)\r\n            nombre: (str, int)\r\n            tri: (str, list)\r\n            champs: (str, list)\r\n            facette.champ: (str, list)\r\n            masquerValeursNulles: (str, bool)\r\n\r\n    Raises:\r\n        ValueError: If the query parameters are not valid or if `data_type` is not valid.\r\n\r\n    Returns:\r\n        dict: The response from the API.\r\n```\r\n\r\n**Example** \r\n```python \r\n# get bulk\r\nclient_bulk = InseeClient()\r\n\r\nbulk_data, header = client_bulk.get_bulk(\r\n  data_type=\"siren\",\r\n  nombre = 5,\r\n  date = \"2022-01-01\",\r\n)\r\n```\r\n\r\n2. **Get data by number :**\r\nGet data either by Siren or Siret numbers. \r\n\r\n```\r\nget_by_number(data_type: 'str' = 'siren', id_code: 'str | int | None' = None, **kwargs: 'dict') -> 'dict' method of pyinsee.insee_client.InseeClient instance\r\n    Get legal data from INSEE API for a given sirnen or siret number.\r\n\r\n    Args:\r\n        data_type (str): The type of data to retrieve, either \"siren\" or \"siret\".\r\n        id_code (str | int): The id_code of the company.\r\n        kwargs (dict | None): The query parameters for the API request.\r\n        date : str                    champs : (str, list)\r\n        masquerValeurNulles: (str, bool)\r\n\r\n    Raises:\r\n        ValueError: If the query parameters are not valid or if `data_type` is not valid.\r\n\r\n    Returns:\r\n        dict: The legal data for the company.\r\n```\r\n\r\n**Example**\r\n\r\n```python\r\n# get by number\r\nclient_by_number = InseeClient()\r\n\r\nsiren_data = client_by_number.get_by_number(\r\n    data_type=\"siren\",\r\n    id_code = \"000325175\",\r\n)\r\n```\r\n### Updates\r\n\r\nThe API provided by the INSEE has changed and currently I'm trying to use Oauth service to retrieve the API key instead of setting it manually.\r\n",
    "bugtrack_url": null,
    "license": "Apache License Version 2.0, January 2004 http://www.apache.org/licenses/  TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION  1. Definitions.  \"License\" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.  \"Licensor\" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.  \"Legal Entity\" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, \"control\" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.  \"You\" (or \"Your\") shall mean an individual or Legal Entity exercising permissions granted by this License.  \"Source\" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.  \"Object\" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.  \"Work\" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).  \"Derivative Works\" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.  \"Contribution\" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, \"submitted\" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as \"Not a Contribution.\"  \"Contributor\" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.  2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.  3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.  4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:  (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and  (b) You must cause any modified files to carry prominent notices stating that You changed the files; and  (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and  (d) If the Work includes a \"NOTICE\" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.  You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.  5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.  6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.  7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.  8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.  9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.  END OF TERMS AND CONDITIONS  APPENDIX: How to apply the Apache License to your work.  To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets \"[]\" replaced with your own identifying information. (Don't include the brackets!)  The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same \"printed page\" as the copyright notice for easier identification within third-party archives.  Copyright [yyyy] [name of copyright owner]  Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ",
    "summary": "A package for collecting and processing company data from INSEE API",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "https://github.com/AymanKUMA/insee-client"
    },
    "split_keywords": [
        "insee",
        " api",
        " company data"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cdad33f9e0afdb79f2bf24a0da2677eb3547d4489fd6b285283965b1045d8ca8",
                "md5": "8fde3a8a7a8002b590ebe866a3c679bd",
                "sha256": "74682d590ec2c249bb79e4af7954ce56c127fc2094caab5dafbd7a6030c96141"
            },
            "downloads": -1,
            "filename": "pyinsee-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8fde3a8a7a8002b590ebe866a3c679bd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 26485,
            "upload_time": "2024-11-29T15:06:01",
            "upload_time_iso_8601": "2024-11-29T15:06:01.889545Z",
            "url": "https://files.pythonhosted.org/packages/cd/ad/33f9e0afdb79f2bf24a0da2677eb3547d4489fd6b285283965b1045d8ca8/pyinsee-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-29 15:06:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "AymanKUMA",
    "github_project": "insee-client",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "certifi",
            "specs": [
                [
                    "==",
                    "2024.8.30"
                ]
            ]
        },
        {
            "name": "charset-normalizer",
            "specs": [
                [
                    "==",
                    "3.3.2"
                ]
            ]
        },
        {
            "name": "colorama",
            "specs": [
                [
                    "==",
                    "0.4.6"
                ]
            ]
        },
        {
            "name": "idna",
            "specs": [
                [
                    "==",
                    "3.10"
                ]
            ]
        },
        {
            "name": "python-dotenv",
            "specs": [
                [
                    "==",
                    "1.0.1"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    "==",
                    "2.32.3"
                ]
            ]
        },
        {
            "name": "tqdm",
            "specs": [
                [
                    "==",
                    "4.66.5"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    "==",
                    "2.2.3"
                ]
            ]
        }
    ],
    "lcname": "pyinsee"
}
        
Elapsed time: 0.65423s