# 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)
~~~
# Available enumerators
* ApiAuthorisationType
* DeviceCommunicationType
* GrantType
* RequestStatus
* Status
# Available classes
* Api
# Available objects
* ApiAuthorisations
* Branches
* CompanyProfiles
* Controllers
* Departments
* Devices
* DailyOvertimeData
* Employees
* EmployeeLeave
* 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.9",
"maintainer_email": "",
"keywords": "",
"author": "Darius Burger",
"author_email": "darius@bcity.me",
"download_url": "https://files.pythonhosted.org/packages/c9/94/deb47570c73e422c3539fb4ea2667b05bb5207e402a75cfeaf7d96691c2c/bc_time-6.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\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* 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": "6.0.0",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2b7d09cad40ce9dd604a9f1363dabc54da5f593fe500f6ba1fe23b807e67dc42",
"md5": "007207550cd394edee67be441e1fe1b9",
"sha256": "4f4d2d3a437b4b59cd38cb3bada39d7449b3562bc21bb604be2464988abe6484"
},
"downloads": -1,
"filename": "bc_time-6.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "007207550cd394edee67be441e1fe1b9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 22939,
"upload_time": "2023-03-17T11:37:26",
"upload_time_iso_8601": "2023-03-17T11:37:26.091725Z",
"url": "https://files.pythonhosted.org/packages/2b/7d/09cad40ce9dd604a9f1363dabc54da5f593fe500f6ba1fe23b807e67dc42/bc_time-6.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c994deb47570c73e422c3539fb4ea2667b05bb5207e402a75cfeaf7d96691c2c",
"md5": "3135a45ca660467b13102b1533163b2b",
"sha256": "d8ae471db3c644aa51f49a6bf77df2acfa7390d13a6a58900a5af241739a2045"
},
"downloads": -1,
"filename": "bc_time-6.0.0.tar.gz",
"has_sig": false,
"md5_digest": "3135a45ca660467b13102b1533163b2b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 15166,
"upload_time": "2023-03-17T11:37:27",
"upload_time_iso_8601": "2023-03-17T11:37:27.460950Z",
"url": "https://files.pythonhosted.org/packages/c9/94/deb47570c73e422c3539fb4ea2667b05bb5207e402a75cfeaf7d96691c2c/bc_time-6.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-17 11:37:27",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "bc-time"
}