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.5
to
0.0.6
+1
-5
adapapi.egg-info/PKG-INFO
Metadata-Version: 2.1
Name: adapapi
Version: 0.0.5
Version: 0.0.6
Summary: A simple Python package using Appen API
Home-page: UNKNOWN
Author: Hayman
License: UNKNOWN
Description: UNKNOWN
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha

@@ -11,0 +7,0 @@ Classifier: Intended Audience :: Developers

+1
-0

@@ -0,1 +1,2 @@

setup.cfg
setup.py

@@ -2,0 +3,0 @@ adapapi/__init__.py

@@ -16,3 +16,6 @@ import requests

self.api_key = api_key
self.headers={
"Authorization": f"Token token={self.api_key}",
}
def job_summary(self, job_id):

@@ -27,4 +30,4 @@ """Getting job stats

"""
params = {'key': self.api_key}
response = requests.get(f'https://api.appen.com/v1/jobs/{job_id}/ping.json', params=params)
params = {}
response = requests.get(f'https://api.appen.com/v1/jobs/{job_id}/ping.json', params=params, headers=self.headers)
if response.status_code != 200:

@@ -56,3 +59,4 @@ log.error(f'---- Status code: {response.status_code} \n {response.text}')

headers = {'content-type': 'application/json'}
params = {'key': self.api_key, 'force': 'true'}
headers.update(self.headers)
params = {'force': 'true'}

@@ -80,4 +84,4 @@ if job_id == None:

params = {'key': self.api_key, 'on': columnname, 'with': character}
response = requests.get(f'https://api.appen.com/v1/jobs/{job_id}/units/split', params=params)
params = {'on': columnname, 'with': character}
response = requests.get(f'https://api.appen.com/v1/jobs/{job_id}/units/split', params=params, headers = self.headers)
if response.status_code != 200:

@@ -97,4 +101,4 @@ log.error(f'---- Status code: {response.status_code} \n {response.text}')

"""
params = {'key': self.api_key}
response = requests.get(f'https://api.appen.com/v1/jobs/{job_id}.json', params=params)
params = {}
response = requests.get(f'https://api.appen.com/v1/jobs/{job_id}.json', params=params, headers = self.headers)
if response.status_code != 200:

@@ -116,4 +120,4 @@ log.error(f'---- Status code: {response.status_code} \n {response.text}')

"""
params = {'key': self.api_key, 'all_units': str(include_uploaded_rows).lower(), 'gold': str(include_tq).lower()}
response = requests.get(f'https://api.appen.com/v1/jobs/{job_id}/copy.json', params=params)
params = {'all_units': str(include_uploaded_rows).lower(), 'gold': str(include_tq).lower()}
response = requests.get(f'https://api.appen.com/v1/jobs/{job_id}/copy.json', params=params, headers = self.headers)
if response.status_code != 200:

@@ -132,3 +136,4 @@ log.error(f'---- Status code: {response.status_code} \n {response.text}')

headers = {'content-type': 'application/json'}
payload = {'key': self.api_key}
headers.update(self.headers)
payload = {}
payload.update({'job': indict})

@@ -141,3 +146,6 @@

read_response = json.loads(response.text)
updated_stuff = {k: read_response[k] for k, v in payload['job'].items()}
try:
updated_stuff = {k: read_response[k] for k, v in payload['job'].items()}
except:
updated_stuff = read_response
log.info(f'---- Status code: {response.status_code} \n---- Updated:\n{updated_stuff}')

@@ -155,3 +163,4 @@

headers = {'content-type': 'application/json'}
payload = {'key': self.api_key}
headers.update(self.headers)
payload = {}
response = requests.get(f'https://api.appen.com/v1/jobs/{job_id}/tags', data=json.dumps(payload), headers=headers)

@@ -172,4 +181,4 @@ if response.status_code != 200:

headers = {'content-type': 'application/json'}
headers.update(self.headers)
payload = {
'key': self.api_key,
'tags': tag

@@ -192,4 +201,4 @@ }

headers = {'content-type': 'application/json'}
headers.update(self.headers)
payload = {
'key': self.api_key,
'tags': tag

@@ -214,2 +223,3 @@ }

headers = {'content-type': 'application/json'}
headers.update(self.headers)
list_job_ids = []

@@ -219,3 +229,2 @@ startNum = 1

payload = {
'key': self.api_key,
'tags': [x.strip() for x in tag.split(',')],

@@ -245,3 +254,3 @@ 'page': startNum

"""
params = {'key': self.api_key, 'type': reporttype}
params = {'type': reporttype}

@@ -254,3 +263,4 @@ reportoption = ['full', 'aggregated', 'json', 'gold_report', 'workset', 'source']

def regenerate(job_id):
response = requests.post(f'https://api.appen.com/v1/jobs/{job_id}/regenerate', params=params)
response = requests.post(f'https://api.appen.com/v1/jobs/{job_id}/regenerate', params=params, headers = self.headers)
if response.status_code != 200:

@@ -282,3 +292,3 @@ log.error(f'---- Status code: {response.status_code} -- {response.text}')

params = {'key': self.api_key, 'type': reporttype}
params = {'type': reporttype}
counter = 0

@@ -289,3 +299,3 @@ time_start = timeit.default_timer()

while True:
response = requests.get(f'https://api.appen.com/v1/jobs/{job_id}.csv', params=params)
response = requests.get(f'https://api.appen.com/v1/jobs/{job_id}.csv', params=params, headers = self.headers)
counter += 1

@@ -297,6 +307,6 @@ log.info(f"-- Response: {response.status_code} -- Count:{counter}")

time.sleep(30)
response = requests.get(f'https://api.appen.com/v1/jobs/{job_id}.csv', params=params)
response = requests.get(f'https://api.appen.com/v1/jobs/{job_id}.csv', params=params, headers = self.headers)
while not response.ok:
log.error(f"Download Failed: Attempting re-download {params['type'].upper()} report {job_id}")
response = requests.get(f'https://api.appen.com/v1/jobs/{job_id}.csv', params=params)
response = requests.get(f'https://api.appen.com/v1/jobs/{job_id}.csv', params=params, headers = self.headers)
time.sleep(30)

@@ -354,3 +364,3 @@

df_list = []
params = {'key': self.api_key, 'type': reporttype}
params = {'type': reporttype}
for jid in list_job_ids:

@@ -362,3 +372,3 @@ counter = 0

while True:
response = requests.get(f'https://api.appen.com/v1/jobs/{jid}.csv', params=params)
response = requests.get(f'https://api.appen.com/v1/jobs/{jid}.csv', params=params, headers=self.headers)
counter += 1

@@ -370,6 +380,6 @@ log.info(f"-- Response: {response.status_code} -- Count:{counter}")

time.sleep(30)
response = requests.get(f'https://api.appen.com/v1/jobs/{jid}.csv', params=params)
response = requests.get(f'https://api.appen.com/v1/jobs/{jid}.csv', params=params, headers=self.headers)
while not response.ok:
log.error(f"Download Failed: Attempting re-download {params['type'].upper()} report {jid}")
response = requests.get(f'https://api.appen.com/v1/jobs/{jid}.csv', params=params)
response = requests.get(f'https://api.appen.com/v1/jobs/{jid}.csv', params=params, headers=self.headers)
time.sleep(30)

@@ -426,7 +436,7 @@

headers = {'content-type': 'application/json'}
headers.update(self.headers)
list_bonus_chunk = max_twenty(amount_in_cents)
for bonus_chunk in list_bonus_chunk:
payload = {'key': self.api_key, 'amount': bonus_chunk}
payload = {'amount': bonus_chunk}
response = requests.post(f'https://api.appen.com/v1/jobs/{job_id}/workers/{worker_id}/bonus.json', data=json.dumps(payload), headers=headers)

@@ -451,3 +461,4 @@ if response.status_code != 200:

headers = {'content-type': 'application/json'}
params = {'key': self.api_key}
headers.update(self.headers)
params = {}
response = requests.get(f'https://api.appen.com/v1/jobs/{job_id}/units/{unit_id}.json', params=params, headers=headers)

@@ -487,3 +498,4 @@ if response.status_code != 200:

headers = {'content-type': 'application/json'}
payload = {'key': self.api_key}
headers.update(self.headers)
payload = {}
try:

@@ -513,4 +525,4 @@ response = requests.get(

headers = {'content-type': 'application/json'}
headers.update(self.headers)
payload = {
'key': self.api_key,
'unit': {'state': state}

@@ -534,4 +546,4 @@ }

headers = {'content-type': 'application/json'}
headers.update(self.headers)
payload = {
'key': self.api_key
}

@@ -551,3 +563,4 @@ response = requests.delete(f'https://api.appen.com/v1/jobs/{job_id}/units/{unit_id}.json', data=json.dumps(payload), headers=headers)

headers = {'content-type': 'application/json'}
params = {'key': self.api_key}
headers.update(self.headers)
params = {}
response = requests.delete(f'https://api.appen.com/v1/jobs/{job_id}.json', params=params, headers=headers)

@@ -572,3 +585,3 @@ if response.status_code != 200:

headers = {'content-type': 'application/json'}
headers.update(self.headers)
if units_to_launch == 'all':

@@ -578,3 +591,2 @@ units_to_launch = self.job_summary(job_id)['all_units']

payload = {
'key': self.api_key,
'channels': ['cf_internal'],

@@ -581,0 +593,0 @@ 'debit': {'units_count': units_to_launch}

Metadata-Version: 2.1
Name: adapapi
Version: 0.0.5
Version: 0.0.6
Summary: A simple Python package using Appen API
Home-page: UNKNOWN
Author: Hayman
License: UNKNOWN
Description: UNKNOWN
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha

@@ -11,0 +7,0 @@ Classifier: Intended Audience :: Developers

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

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

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