bc-time


Namebc-time JSON
Version 8.0.0 PyPI version JSON
download
home_pagehttps://bitbucket.org/dburger/bc_time_api_sdk/src/master/
SummarySDK that helps with integration via the Binary City Time API.
upload_time2023-04-26 11:11:44
maintainer
docs_urlNone
authorDarius Burger
requires_python>=3.10
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Project description
Package Version Python Versions License

bc_time is the Binary City (BC) Time Application Programming Interface (API) Software Development Kit (SDK) for Python, that allows Python developers to develop integration with [BC Time](https://time.bcity.me).

bc_time is maintained and published by [Binary City](https://bcity.me).

# Getting started
Assuming that you have a supported version of Python installed, you can first set up your environment with:

$ python venv .venv
...
$ . .venv/bin/activate
Then, you can install bc_time from PyPI with:

$ python pip install bc_time
or install from source with:
~~~
$ git clone git@bitbucket.org:dburger/bc_time_api_sdk.git
$ cd bc_time_api_sdk
$ python pip install -r requirements.txt
$ python pip install -e .
~~~

# Using bc_time
After you've installed bc_time, the next step is to set-up your credentials at:\
$HOME/.bc_time/config

~~~
[default]
client_id = YOUR_CLIENT_ID
client_secret = YOUR_CLIENT_SECRET
crypt_key = YOUR_CRYPT_KEY
grant_type = YOUR_GRANT_TYPE ; authorisation_code | client_credentials | urn:ietf:params:oauth:grant-type:jwt-bearer
private_key_file_path = FILE_PATH_TO_YOUR_PRIVATE_KEY
time_domain = BETA_OR_OTHER_NON_PRODUCTION_TIME_DOMAIN ; Optional.
~~~

## How to create a private/public key pair
Using OpenSSL, follow these to steps to generate a private & public key par
~~~
 openssl genrsa -out privatekey.pem 1024
 openssl req -new -x509 -key privatekey.pem -out publickey.cer -days 1825
 ~~~

Then, from a Python interpreter:
~~~
>>> import bc_time
>>> visitors = bc_time.Visitors()
>>> response_data = visitors.get_all_using_pagination(filters={'filter_status': bc_time.Status.active})
>>> if response_data['status'] == bc_time.RequestStatus.success:
                for visitor in response_data['data']:
                        print(visitor)
~~~

You also have the option to specify your credentials via the constructor of the Api class:
~~~
>>> import bc_time
>>> api = bc_time.Api(
                client_id='YOUR_CLIENT_ID',
                client_secret='YOUR_CLIENT_SECRET',
                crypt_key='YOUR_CRYPT_KEY',
                grant_type='YOUR_GRANT_TYPE' # Consider using the bc_time.GrantType constants, for example bc_time.GrantType.CLIENT_CREDENTIALS
        )
>>> visitors = bc_time.Visitors(api)
>>> response_data = visitors.get_all_using_pagination()
>>> if response_data['status'] == bc_time.RequestStatus.success:
                for visitor in response_data['data']:
                        print(visitor)
~~~

Using grant type, password (constant, bc_time.GrantType.USER_CREDENTIALS):
~~~
>>> import bc_time
>>> api = bc_time.Api(
                client_secret = 'YOUR_CLIENT_SECRET', # If the client secret is specified in ~/.bc_time/config then this parameter can be safely omitted.
                grant_type=bc_time.GrantType.USER_CREDENTIALS # Override grant type as specified in ~/.bc_time/config; consider using the bc_time.GrantType constant.
        )
>>> api.token.username = 'THE_USERNAME'
>>> api.token.password = 'THE_PASSWORD'
>>> token_acquired, _ = api.token.request_token()
>>> if token_acquired:
                employees = bc_time.Employees(api)
                response_data = employees.get_all_using_pagination()
                if response_data['status'] == bc_time.RequestStatus.success:
                        for employee in response_data['data']:
                                print(employee)
~~~

# Available enumerators
* ApiAuthorisationType
* DeviceCommunicationType
* GrantType
* RequestStatus
* Status

# Available classes
* Api

# Available objects
* ApiAuthorisations
* Branches
* CompanyProfiles
* Controllers
* Departments
* Devices
* DailyOvertimeData
* Employees
* EmployeeLeave
* PeriodOvertimeData
* Settings
* Visitors
* VisitorGroups

# Available methods

## For (most) objects
* create
* create_many
* update
* update_many
* get_all_using_pagination
* get_one
* get_many

## For membership/group objects
Please note that group objects also has access the the methods as defined for Objects.

* add_visitor_to_group
* remove_visitor_from_group
* get_all_members_using_pagination

All methods will return a Dictionary that - depending on the response - may contain the following keys:
* status
* data

Status IDs can be referenced using the enumerator bc_time.RequestStatus.


# Documentation

Please consult our [BC Time API documentation](https://docs.google.com/document/d/1sI0mUy8-65NuDfVKKBxzJSyY9olkjWp3xmtRnR58Lkg/) for more information.

            

Raw data

            {
    "_id": null,
    "home_page": "https://bitbucket.org/dburger/bc_time_api_sdk/src/master/",
    "name": "bc-time",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "",
    "author": "Darius Burger",
    "author_email": "darius@bcity.me",
    "download_url": "https://files.pythonhosted.org/packages/ba/e1/fe0a4de48c70c6922ebd25c943c6265f6367110589d1ec017943da47f000/bc_time-8.0.0.tar.gz",
    "platform": null,
    "description": "# Project description\nPackage Version Python Versions License\n\nbc_time is the Binary City (BC) Time Application Programming Interface (API) Software Development Kit (SDK) for Python, that allows Python developers to develop integration with [BC Time](https://time.bcity.me).\n\nbc_time is maintained and published by [Binary City](https://bcity.me).\n\n# Getting started\nAssuming that you have a supported version of Python installed, you can first set up your environment with:\n\n$ python venv .venv\n...\n$ . .venv/bin/activate\nThen, you can install bc_time from PyPI with:\n\n$ python pip install bc_time\nor install from source with:\n~~~\n$ git clone git@bitbucket.org:dburger/bc_time_api_sdk.git\n$ cd bc_time_api_sdk\n$ python pip install -r requirements.txt\n$ python pip install -e .\n~~~\n\n# Using bc_time\nAfter you've installed bc_time, the next step is to set-up your credentials at:\\\n$HOME/.bc_time/config\n\n~~~\n[default]\nclient_id = YOUR_CLIENT_ID\nclient_secret = YOUR_CLIENT_SECRET\ncrypt_key = YOUR_CRYPT_KEY\ngrant_type = YOUR_GRANT_TYPE ; authorisation_code | client_credentials | urn:ietf:params:oauth:grant-type:jwt-bearer\nprivate_key_file_path = FILE_PATH_TO_YOUR_PRIVATE_KEY\ntime_domain = BETA_OR_OTHER_NON_PRODUCTION_TIME_DOMAIN ; Optional.\n~~~\n\n## How to create a private/public key pair\nUsing OpenSSL, follow these to steps to generate a private & public key par\n~~~\n openssl genrsa -out privatekey.pem 1024\n openssl req -new -x509 -key privatekey.pem -out publickey.cer -days 1825\n ~~~\n\nThen, from a Python interpreter:\n~~~\n>>> import bc_time\n>>> visitors = bc_time.Visitors()\n>>> response_data = visitors.get_all_using_pagination(filters={'filter_status': bc_time.Status.active})\n>>> if response_data['status'] == bc_time.RequestStatus.success:\n                for visitor in response_data['data']:\n                        print(visitor)\n~~~\n\nYou also have the option to specify your credentials via the constructor of the Api class:\n~~~\n>>> import bc_time\n>>> api = bc_time.Api(\n                client_id='YOUR_CLIENT_ID',\n                client_secret='YOUR_CLIENT_SECRET',\n                crypt_key='YOUR_CRYPT_KEY',\n                grant_type='YOUR_GRANT_TYPE' # Consider using the bc_time.GrantType constants, for example bc_time.GrantType.CLIENT_CREDENTIALS\n        )\n>>> visitors = bc_time.Visitors(api)\n>>> response_data = visitors.get_all_using_pagination()\n>>> if response_data['status'] == bc_time.RequestStatus.success:\n                for visitor in response_data['data']:\n                        print(visitor)\n~~~\n\nUsing grant type, password (constant, bc_time.GrantType.USER_CREDENTIALS):\n~~~\n>>> import bc_time\n>>> api = bc_time.Api(\n                client_secret = 'YOUR_CLIENT_SECRET', # If the client secret is specified in ~/.bc_time/config then this parameter can be safely omitted.\n                grant_type=bc_time.GrantType.USER_CREDENTIALS # Override grant type as specified in ~/.bc_time/config; consider using the bc_time.GrantType constant.\n        )\n>>> api.token.username = 'THE_USERNAME'\n>>> api.token.password = 'THE_PASSWORD'\n>>> token_acquired, _ = api.token.request_token()\n>>> if token_acquired:\n                employees = bc_time.Employees(api)\n                response_data = employees.get_all_using_pagination()\n                if response_data['status'] == bc_time.RequestStatus.success:\n                        for employee in response_data['data']:\n                                print(employee)\n~~~\n\n# Available enumerators\n* ApiAuthorisationType\n* DeviceCommunicationType\n* GrantType\n* RequestStatus\n* Status\n\n# Available classes\n* Api\n\n# Available objects\n* ApiAuthorisations\n* Branches\n* CompanyProfiles\n* Controllers\n* Departments\n* Devices\n* DailyOvertimeData\n* Employees\n* EmployeeLeave\n* PeriodOvertimeData\n* Settings\n* Visitors\n* VisitorGroups\n\n# Available methods\n\n## For (most) objects\n* create\n* create_many\n* update\n* update_many\n* get_all_using_pagination\n* get_one\n* get_many\n\n## For membership/group objects\nPlease note that group objects also has access the the methods as defined for Objects.\n\n* add_visitor_to_group\n* remove_visitor_from_group\n* get_all_members_using_pagination\n\nAll methods will return a Dictionary that - depending on the response - may contain the following keys:\n* status\n* data\n\nStatus IDs can be referenced using the enumerator bc_time.RequestStatus.\n\n\n# Documentation\n\nPlease consult our [BC Time API documentation](https://docs.google.com/document/d/1sI0mUy8-65NuDfVKKBxzJSyY9olkjWp3xmtRnR58Lkg/) for more information.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "SDK that helps with integration via the Binary City Time API.",
    "version": "8.0.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "863cafd3829a0b0e4fc1cc96484d79481e5f0ab6d385f5d54bc8925758dedbfa",
                "md5": "72de431ca5955d5d4c4a816e1d1b0be3",
                "sha256": "45b8e34f33a5d399dc0dc3f039b18c68a0c82ad4bc0ce855af3cc8357e156af4"
            },
            "downloads": -1,
            "filename": "bc_time-8.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "72de431ca5955d5d4c4a816e1d1b0be3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 23844,
            "upload_time": "2023-04-26T11:11:41",
            "upload_time_iso_8601": "2023-04-26T11:11:41.918194Z",
            "url": "https://files.pythonhosted.org/packages/86/3c/afd3829a0b0e4fc1cc96484d79481e5f0ab6d385f5d54bc8925758dedbfa/bc_time-8.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bae1fe0a4de48c70c6922ebd25c943c6265f6367110589d1ec017943da47f000",
                "md5": "b30b3f54746624080258bd4d86919799",
                "sha256": "4e4c69a547c2acc29f612c4bdddaa6e33c2523b7c04dee75d3966ccb90b06e37"
            },
            "downloads": -1,
            "filename": "bc_time-8.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "b30b3f54746624080258bd4d86919799",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 16041,
            "upload_time": "2023-04-26T11:11:44",
            "upload_time_iso_8601": "2023-04-26T11:11:44.576275Z",
            "url": "https://files.pythonhosted.org/packages/ba/e1/fe0a4de48c70c6922ebd25c943c6265f6367110589d1ec017943da47f000/bc_time-8.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-26 11:11:44",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "bc-time"
}
        
Elapsed time: 0.05896s