Giter VIP home page Giter VIP logo

treblle / treblle-python Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 6.0 44 KB

The official Treblle SDK for Python, tailored for the Django framework. Seamlessly integrate Treblle into your Django applications to effortlessly manage communication with your dashboard, transmit errors, and safeguard sensitive data.

Home Page: https://www.treblle.com/

License: MIT License

Python 100.00%
api-monitoring api-observability python treblle treblle-sdk api backend developer-tool django logging

treblle-python's Introduction

Treblle

Integrations   •   Website   •   Docs   •   Blog   •   Twitter   •   Discord


Treblle is a lightweight SDK that helps Engineering and Product teams build, ship & maintain REST based APIs faster.

Features




How Treblle Works

Once you’ve integrated a Treblle SDK in your codebase, this SDK will send requests and response data to your Treblle Dashboard.

In your Treblle Dashboard you get to see real-time requests to your API, auto-generated API docs, API analytics like how fast the response was for an endpoint, the load size of the response, etc.

Treblle also uses the requests sent to your Dashboard to calculate your API score which is a quality score that’s calculated based on the performance, quality, and security best practices for your API.

Visit https://docs.treblle.com for the complete documentation.

Security

Masking fields

Masking fields ensure certain sensitive data are removed before being sent to Treblle.

To make sure masking is done before any data leaves your server we built it into all our SDKs.

This means data masking is super fast and happens on a programming level before the API request is sent to Treblle. You can customize exactly which fields are masked when you’re integrating the SDK.

Visit the Masked fields section of the docs for the complete documentation.

Get Started

  1. Sign in to Treblle.
  2. Create a Treblle project.
  3. Setup the SDK for your platform.

Install the SDK

You can install Treblle for django via PYPi. Simply run the following command:

$ pip install treblle

Don’t forget to load the required python modules in your settings.py like so:

INSTALLED_APPS = [
...
'treblle',
]
MIDDLEWARE_CLASSES = [
...
'treblle.middleware.TreblleMiddleware',
]

After you've retrieved your API Key and project ID, initialize Treblle in your settinsg.py file like so for django:

TREBLLE_INFO = {
'api_key': os.environ.get('TREBLLE_API_KEY'),
'project_id': os.environ.get('TREBLLE_PROJECT_ID')
}

See the docs for this SDK to learn more.

Available SDKs

Treblle provides open-source SDKs that let you seamlessly integrate Treblle with your REST-based APIs.

See the docs for more on SDKs and Integrations.

Other Packages

Besides the SDKs, we also provide helpers and configuration used for SDK development. If you're thinking about contributing to or creating a SDK, have a look at the resources below:

  • treblle-utils: A set of helpers and utility functions useful for the JavaScript SDKs.
  • php-utils: A set of helpers and utility functions useful for the PHP SDKs.

Community 💙

First and foremost: Star and watch this repository to stay up-to-date.

Also, follow our Blog, and on Twitter.

You can chat with the team and other members on Discord and follow our tutorials and other video material at YouTube.

Treblle Discord

Treblle YouTube

Treblle on Twitter

How to contribute

Here are some ways of contributing to making Treblle better:

  • Try out Treblle, and let us know ways to make Treblle better for you. Let us know here on Discord.
  • Join our Discord and connect with other members to share and learn from.
  • Send a pull request to any of our open source repositories on Github. Check the contribution guide on the repo you want to contribute to for more details about how to contribute. We're looking forward to your contribution!

Contributors

A table of avatars from the project's contributors

treblle-python's People

Contributors

cindreta avatar dominuskelvin avatar juststeveking avatar the-dylanmatthews avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

treblle-python's Issues

Implement get_base_url

Currently using a hardcoded Treblle URL, let's implement a function that gives us a random Treblle URL to use each time we call it.

API not reflecting on dashboard

I have configured treblle with my local environment below are my settings

if TREBLLE_ENABLED:
    INSTALLED_APPS += ["treblle"]
    MIDDLEWARE += ["treblle.middleware.TreblleMiddleware"]

    TREBLLE_INFO = {
        "api_key": TREBLLE_API_KEY,
        "project_id": TREBLLE_PROJECT_ID,
        "hidden_keys": ["token", "otp", "password", "mobile_account_no"],
    }

when i hit the API I do get this log from treblle

backend_1           | treblle Trebble response code 200
backend_1           | treblle Trebble response content b'{"status":true,"message":"Treblle got it"}'

but nothing reflect on my dashboard (sometimes it doesn't)
image

Project settings are below
MS Paint _ Microsoft Paint Online

Exception in handle_response method while attempting to decode response content

I just came across Treblle and wanted to test it locally. I am trying to integrate it into a DRF project, but the library is throwing an exception inside the handle_response method, while trying to decode the response object.

On this line it is trying to process the following byte content

b'\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff}\x96OO\xdb@\x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)k\x02\xd0E\x81|\xcah\xd7\x0f\xf1\xb0o\xcf\x80o3}\xef\xd0W$\x03zfzG2\x9b\xb2\x15"\xf7\xc9\x88\x9aG_\xb1\xcc\xcbl\x84\x0bn\xb4\xf3Z8<\xbb\xc1\xb4\xd2\x7f\xb8\x10i\x92)L\xdfY\xb7\x15,\xd8\x9d\xcc\xbaP%\x03r6&\x90|U\x90\xd8\xaf\x15C\xda\x02\xafd\xc0\xe8/\xbcv&\x89\xdb\xd1o\xdc\x9b\\xd2\xf3SY\x9bW,\xde8\x07\xd3\xcc\xb7uLZy\x89\xc8\xc1\xd5 wzc\xc5\x16\xe5\xe0\xdb=\xa5\xba\xe9\x1c\x1d\\xa3\xf3\xcf\xa0F\x1b\xe3\xbbzG\xe0\xf3=\x05[=m\xb5\x0b6\x99\x01i\xa7\xa0\xa5Y\x15\xffw\xc0\xf03\x10\x04s\xdb\x1e\x91w\x0e\xe4}\xad\xc0\xf2\xce\x81\xbc\x0b\xdd\xe7\x86\xd7\xc2\xf5\x0b\x90\x1b\x0b\xfdG\xc6\xff\xe2\xbb\x04\x97\x86\x83.\x93y\xff\xcc'1\x9b\xacK\xf26\xd4]\x8c\xfaC\x06Z\x82U\xf8\xff\x9c\x15\xc7\x0b\x849T\xbf\x02\xf3[\x06\xaa\xc4\xef\x80(Zi\xd7\xc4\xe0\x12G"\xf4\xa5\t\xe9\x8e\x15p\xc7:\xde\x1e\x8f\xc4\x1b\xf8\xb0\xad)F\x90\xd9\x04\xe9\xf05:_\xfb\x90\x1cjh\rrn\xcd\xbe\xb0\xc6\xb3<\x1d\x0co\xdd\xd9&\xf6"\xd0\x18C\xbf\x9e\xff\x01\xd8\xd7Q\xa3\x0f\x0c\x00\x00'`

and here is the error
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

I am simply trying to integrate Treblle into an existing DRF based project and everything else is working perfectly so not sure about what may be wrong.

Typo in response printed to console

When the response from Treblle is received, this is what is sent to the console:

self.treblle_print(f'Trebble response code {treblle_request.status_code}')

Instead, it should be:

self.treblle_print(f'Treblle response code {treblle_request.status_code}')

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.