Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

adapapi

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adapapi - npm Package Compare versions

Comparing version
0.0.4
to
0.0.5
+1
-1
adapapi.egg-info/PKG-INFO
Metadata-Version: 2.1
Name: adapapi
Version: 0.0.4
Version: 0.0.5
Summary: A simple Python package using Appen API

@@ -5,0 +5,0 @@ Home-page: UNKNOWN

@@ -234,2 +234,7 @@ import requests

reportoption = ['full', 'aggregated', 'json', 'gold_report', 'workset', 'source']
if reporttype not in reportoption:
log.error(f'Invalid report type {reporttype}. Please select one of the following: {reportoption}')
return
def regenerate(job_id):

@@ -260,3 +265,3 @@ response = requests.post(f'https://api.appen.com/v1/jobs/{job_id}/regenerate', params=params)

if reporttype not in reportoption:
info.error(f'Invalid report type {reporttype}. Please select one of the following: {reportoption}')
log.error(f'Invalid report type {reporttype}. Please select one of the following: {reportoption}')
return

@@ -415,2 +420,20 @@

def unit_json(self, job_id, unit_id):
"""Get unit json
Args:
job_id (int): ADAP Job ID
unit_id (int): ADAP Unit ID
Returns:
dict: Unit JSON
"""
headers = {'content-type': 'application/json'}
params = {'key': self.api_key}
response = requests.get(f'https://api.appen.com/v1/jobs/{job_id}/units/{unit_id}.json', params=params, headers=headers)
if response.status_code != 200:
log.error(f'---- Status code: {response.status_code} \n {response.text}')
else:
return(json.loads(response.text))
def get_unit_state(self, job_id, unit_id):

@@ -426,13 +449,5 @@ """Retrieves current unit state within job

"""
headers = {'content-type': 'application/json'}
payload = {'key': self.api_key}
try:
response = requests.get(
f'https://api.appen.com/v1/jobs/{job_id}/units/{unit_id}.json', data=json.dumps(payload), headers=headers)
if response.status_code != 200:
msg = f'For unit_id {unit_id} -- Status code: {response.status_code} \n {response.text}'
return({'_unit_id': unit_id, 'error_msg': msg})
else:
read_response = json.loads(response.text)
return ({'_unit_id': unit_id, '_unit_state': read_response['state']})
j = self.unit_json(job_id, unit_id)
return ({'_unit_id': unit_id, '_unit_state': j['state']})
except Exception as e:

@@ -439,0 +454,0 @@ return({'_unit_id': unit_id, 'error_msg': e})

Metadata-Version: 2.1
Name: adapapi
Version: 0.0.4
Version: 0.0.5
Summary: A simple Python package using Appen API

@@ -5,0 +5,0 @@ Home-page: UNKNOWN

@@ -5,3 +5,3 @@ from setuptools import setup, find_packages

name='adapapi',
version='0.0.4',
version='0.0.5',
description='A simple Python package using Appen API',

@@ -8,0 +8,0 @@ long_description_content_type='text/markdown',