Giter Site home page Giter Site logo

dribia / drifactorial Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 0.0 692 KB

Python client for the Factorial API.

Home Page: https://dribia.github.io/drifactorial/

License: MIT License

Python 97.32% Shell 2.68%
python api-client hr hr-software human-resources

drifactorial's Introduction

drifactorial

Test Publish Coverage Package version

Python client for the Factorial API.


Documentation: https://dribia.github.io/drifactorial

Source Code: https://github.com/dribia/drifactorial


Factorial is a software dedicated to manage everything related to HR.

Drifactorial provides a tiny Python interface to the official API.

Key features

  • Authorize programatic access to your application.
  • Obtain and refresh access tokens.
  • Implements generic GET and POST methods.
  • Parses responses to Pydantic models.
  • Easily implement additional methods.

Example

The simplest example.

from drifactorial import Factorial
from datetime import datetime

factorial = Factorial(access_token="abc")

# get list of employees
employees = factorial.get_employees()
# get list of company holidays
holidays = factorial.get_holidays()
# get list of leaves
leaves = factorial.get_leaves()
# get list of days off of an employee
daysoff = factorial.get_daysoff(employee_id=123)
# get list of all shifts in October 2021
shifts = factorial.get_shifts(year=2021, month=10)
# get single employee
single_employee = factorial.get_single_employee(employee_id=123)
# get my account
account = factorial.get_account()

# clock in shift
clock_in = datetime(2021, 10, 1, 9, 0)
new_shift = factorial.clock_in(now=clock_in, employee_id=123)
# clock out shift
clock_out = datetime(2021, 10, 1, 13, 0)
updated_shift = factorial.clock_out(now=clock_in, employee_id=123)

drifactorial's People

Contributors

airibarne avatar nikosdribia avatar uladribia avatar xrhoffmann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

drifactorial's Issues

Unable to authorize

Expected Behavior

To push the Authorization Code via the obtain_access_token function and receive the access_token.

Current Behavior

Currently I am receiving the authorization code, but unable to get the access_token

Possible Solution

Steps to Reproduce

  1. Open new project -> pip install drifactorial
  2. Following the guide: https://dribia.github.io/drifactorial/usage/authorization/
  3. Up tot "Authorize your user for using the application" goes well
  4. When I enter:
    token = dummy_factorial.obtain_access_token( client_id=client_id, client_secret=client_secret, redirect_uri=redirect_uri, authorization_key=authorization_key, )

I recieve the following errors:
>>> token = dummy_factorial.obtain_access_token( ... client_id=client_id, ... client_secret=client_secret, ... redirect_uri=redirect_uri, ... authorization_key=authorization_key, ... ) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\CND127KONB\PycharmProjects\pythonProject\venv\lib\site-packages\drifactorial\__init__.py", line 379, in obtain_access_token response = self._post_token(data=data) File "C:\Users\CND127KONB\PycharmProjects\pythonProject\venv\lib\site-packages\drifactorial\__init__.py", line 360, in _post_token response = request.urlopen(request_url) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1520.0_x64__qbz5n2kfra8p0\lib\urllib\request.py", line 216, in urlopen return opener.open(url, data, timeout) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1520.0_x64__qbz5n2kfra8p0\lib\urllib\request.py", line 525, in open response = meth(req, response) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1520.0_x64__qbz5n2kfra8p0\lib\urllib\request.py", line 634, in http_response response = self.parent.error( File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1520.0_x64__qbz5n2kfra8p0\lib\urllib\request.py", line 563, in error return self._call_chain(*args) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1520.0_x64__qbz5n2kfra8p0\lib\urllib\request.py", line 496, in _call_chain result = func(*args) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1520.0_x64__qbz5n2kfra8p0\lib\urllib\request.py", line 643, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 400: Bad Request

  1. I have tried putting in the client_id, client_secret, redirect_uri and authorization_key manually by hand, so to make sure they match..
  2. Looking into the drifactorial -> init.py file, hovering over the variables named at step 1, they do not visualize the variable values..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.