remove build + update git ignore

This commit is contained in:
Zadat Olayinka 2021-04-21 11:02:03 +01:00
parent cad91550e5
commit 61ec413de0
11 changed files with 3 additions and 112 deletions

View file

@ -1 +1,4 @@
*.pyc
build/
dist/
fyipe_sdk/*.egg-info

View file

@ -1,71 +0,0 @@
import requests
from fyipe_sdk.logtype import LogType
class FyipeLogger:
def __init__(self, apiUrl, applicationLogId, applicationLogKey):
self.applicationLogId = applicationLogId
self.applicationLogKey = applicationLogKey
self.apiUrl = apiUrl + "/application-log/" + applicationLogId + "/log"
def log(self, data, tags=None):
"""
Sends a log with type info
"""
# validate the data is of type string or type object/dictionary
if isinstance(data, (str, dict)) != True:
return "Invalid Content to be logged"
# if a tag is passed, validate that it is of type string or array/list
if tags is not None:
if isinstance(tags, (str, list)) != True:
return "Invalid Content Tags to be logged"
# make request to the API
return self._makeApiRequest_(data, LogType.INFO, tags)
def warning(self, data, tags=None):
"""
Sends a log with type warning
"""
# validate the data is of type string or type object/dictionary
if isinstance(data, (str, dict)) != True:
return "Invalid Content to be logged"
# if a tag is passed, validate that it is of type string or array/list
if tags is not None:
if isinstance(tags, (str, list)) != True:
return "Invalid Content Tags to be logged"
# make request to the API
return self._makeApiRequest_(data, LogType.WARNING, tags)
def error(self, data, tags=None):
"""
Sends a log with type error
"""
# validate the data is of type string or type object/dictionary
if isinstance(data, (str, dict)) != True:
return "Invalid Content to be logged"
# if a tag is passed, validate that it is of type string or array/list
if tags is not None:
if isinstance(tags, (str, list)) != True:
return "Invalid Content Tags to be logged"
# make request to the API
return self._makeApiRequest_(data, LogType.ERROR, tags)
def _makeApiRequest_(self, content, logType, tags):
data = {
"content": content,
"applicationLogKey": self.applicationLogKey,
"type": logType,
}
if tags is not None:
data["tags"] = tags
response = requests.post(self.apiUrl, json=data)
return response.json()

View file

@ -1,4 +0,0 @@
class LogType:
INFO = "info"
WARNING = "warning"
ERROR = "error"

Binary file not shown.

Binary file not shown.

View file

@ -1,21 +0,0 @@
Metadata-Version: 2.1
Name: fyipe-sdk
Version: 1.0.0
Summary: A Fyipe package that tracks error event and send logs from your applications to your fyipe dashboard.
Home-page: https://github.com/Fyipe/python-sdk
Author: HackerBay, Inc.
Author-email: hello@hackerbay.io
License: UNKNOWN
Project-URL: Bug Tracker, https://github.com/Fyipe/python-sdk/issues
Description: # Fyipe SDK
A fyipe sdk for application logger that can be used to send logs about your applications created on your fypie dashboard which can also used for error tracking
## Installation
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown

View file

@ -1,12 +0,0 @@
README.md
pyproject.toml
setup.cfg
setup.py
fyipe_sdk/fyipe_sdk/__init__.py
fyipe_sdk/fyipe_sdk/logger.py
fyipe_sdk/fyipe_sdk/logtype.py
fyipe_sdk/fyipe_sdk.egg-info/PKG-INFO
fyipe_sdk/fyipe_sdk.egg-info/SOURCES.txt
fyipe_sdk/fyipe_sdk.egg-info/dependency_links.txt
fyipe_sdk/fyipe_sdk.egg-info/requires.txt
fyipe_sdk/fyipe_sdk.egg-info/top_level.txt

View file

@ -1,2 +0,0 @@
requests
faker

View file

@ -1 +0,0 @@
fyipe_sdk