adapapi
Advanced tools
| Metadata-Version: 2.1 | ||
| Name: adapapi | ||
| Version: 0.0.8 | ||
| Version: 0.0.9 | ||
| Summary: A simple Python package using Appen API | ||
@@ -81,3 +81,11 @@ Author: appenps | ||
| int: New ADAP Job ID | ||
| `get_all_jobs(self): | ||
| """Retrieves list of all jobs. | ||
| More information https://developer.appen.com/#tag/Account-Info/paths/~1jobs.json/get | ||
| Returns: | ||
| list: List of all jobs. | ||
| """ | ||
| `filter_jobs_by_tag(self, tag)` | ||
@@ -93,2 +101,23 @@ : Retrieves list of job IDs with associated tag. | ||
| `filter_jobs_by_title(self, title): | ||
| """Retrieves list of job IDs with associated title. | ||
| More information https://developer.appen.com/#tag/Account-Info/paths/~1jobs.json/get | ||
| Args: | ||
| title (str): keywords to search for in job title | ||
| Returns: | ||
| list: List of jobs with title | ||
| """ | ||
| `filter_jobs_by_copied_from(self, copied_from): | ||
| """Retrieves list of job IDs with associated copied_from job_id. | ||
| More information https://developer.appen.com/#tag/Account-Info/paths/~1jobs.json/get | ||
| Args: | ||
| copied_from (int): fileter jobs by the job id they were copied from | ||
| Returns: | ||
| list: List of jobs copied from the copied_from_id | ||
| `get_unit_state(self, job_id, unit_id)` | ||
@@ -95,0 +124,0 @@ : Retrieves current unit state within job |
+100
-0
@@ -201,2 +201,30 @@ import requests | ||
| def get_all_jobs(self): | ||
| """Retrieves list of all job IDs. | ||
| More information https://developer.appen.com/#tag/Account-Info/paths/~1jobs.json/get | ||
| Returns: | ||
| list: List of all job IDs | ||
| """ | ||
| headers = {'content-type': 'application/json'} | ||
| headers.update(self.headers) | ||
| jobs = [] | ||
| startNum = 1 | ||
| while True: | ||
| payload = { | ||
| 'page': startNum | ||
| } | ||
| response = requests.get(f'https://api.appen.com/v1/jobs.json', data=json.dumps(payload), headers=headers) | ||
| if response.status_code != 200: | ||
| log.error(f'---- Status code: {response.status_code} \n {response.text}') | ||
| break | ||
| else: | ||
| jobs.extend(json.loads(response.text)) | ||
| if len(json.loads(response.text)) == 0: | ||
| break | ||
| else: | ||
| startNum += 1 | ||
| return jobs | ||
| def filter_jobs_by_tag(self, tag): | ||
@@ -235,2 +263,74 @@ """Retrieves list of job IDs with associated tag. | ||
| def filter_jobs_by_title(self, title): | ||
| """Retrieves list of job IDs with associated title. | ||
| More information https://developer.appen.com/#tag/Account-Info/paths/~1jobs.json/get | ||
| Args: | ||
| title (str): keywords to search for in job title | ||
| Returns: | ||
| list: List of jobs with title | ||
| """ | ||
| headers = {'content-type': 'application/json'} | ||
| headers.update(self.headers) | ||
| jobs = [] | ||
| startNum = 1 | ||
| while True: | ||
| payload = { | ||
| 'page': startNum | ||
| } | ||
| response = requests.get(f'https://api.appen.com/v1/jobs.json', data=json.dumps(payload), headers=headers) | ||
| if response.status_code != 200: | ||
| log.error(f'---- Status code: {response.status_code} \n {response.text}') | ||
| break | ||
| else: | ||
| jobs.extend(json.loads(response.text)) | ||
| if len(json.loads(response.text)) == 0: | ||
| break | ||
| else: | ||
| startNum += 1 | ||
| qualifiying_jobs = [] | ||
| for job in jobs: | ||
| if title.lower() in job['title'].lower(): | ||
| qualifiying_jobs.append(job) | ||
| return qualifiying_jobs | ||
| def filter_jobs_by_copied_from(self, copied_from): | ||
| """Retrieves list of job IDs with associated title. | ||
| More information https://developer.appen.com/#tag/Account-Info/paths/~1jobs.json/get | ||
| Args: | ||
| copied_from (int): fileter jobs by the job id they were copied from | ||
| Returns: | ||
| list: List of jobs copied from the job id | ||
| """ | ||
| headers = {'content-type': 'application/json'} | ||
| headers.update(self.headers) | ||
| jobs = [] | ||
| startNum = 1 | ||
| while True: | ||
| payload = { | ||
| 'page': startNum | ||
| } | ||
| response = requests.get(f'https://api.appen.com/v1/jobs.json', data=json.dumps(payload), headers=headers) | ||
| if response.status_code != 200: | ||
| log.error(f'---- Status code: {response.status_code} \n {response.text}') | ||
| break | ||
| else: | ||
| jobs.extend(json.loads(response.text)) | ||
| if len(json.loads(response.text)) == 0: | ||
| break | ||
| else: | ||
| startNum += 1 | ||
| qualifiying_jobs = [] | ||
| for job in jobs: | ||
| try: | ||
| if job['copied_from'] == copied_from: | ||
| qualifiying_jobs.append(job) | ||
| except: | ||
| continue | ||
| return qualifiying_jobs | ||
| def regenerate_jobid(self, job_id, reporttype): | ||
@@ -237,0 +337,0 @@ """Regenerates ADAP job |
+30
-1
| Metadata-Version: 2.1 | ||
| Name: adapapi | ||
| Version: 0.0.8 | ||
| Version: 0.0.9 | ||
| Summary: A simple Python package using Appen API | ||
@@ -81,3 +81,11 @@ Author: appenps | ||
| int: New ADAP Job ID | ||
| `get_all_jobs(self): | ||
| """Retrieves list of all jobs. | ||
| More information https://developer.appen.com/#tag/Account-Info/paths/~1jobs.json/get | ||
| Returns: | ||
| list: List of all jobs. | ||
| """ | ||
| `filter_jobs_by_tag(self, tag)` | ||
@@ -93,2 +101,23 @@ : Retrieves list of job IDs with associated tag. | ||
| `filter_jobs_by_title(self, title): | ||
| """Retrieves list of job IDs with associated title. | ||
| More information https://developer.appen.com/#tag/Account-Info/paths/~1jobs.json/get | ||
| Args: | ||
| title (str): keywords to search for in job title | ||
| Returns: | ||
| list: List of jobs with title | ||
| """ | ||
| `filter_jobs_by_copied_from(self, copied_from): | ||
| """Retrieves list of job IDs with associated copied_from job_id. | ||
| More information https://developer.appen.com/#tag/Account-Info/paths/~1jobs.json/get | ||
| Args: | ||
| copied_from (int): fileter jobs by the job id they were copied from | ||
| Returns: | ||
| list: List of jobs copied from the copied_from_id | ||
| `get_unit_state(self, job_id, unit_id)` | ||
@@ -95,0 +124,0 @@ : Retrieves current unit state within job |
+29
-0
@@ -65,3 +65,11 @@ Module adapapi | ||
| int: New ADAP Job ID | ||
| `get_all_jobs(self): | ||
| """Retrieves list of all jobs. | ||
| More information https://developer.appen.com/#tag/Account-Info/paths/~1jobs.json/get | ||
| Returns: | ||
| list: List of all jobs. | ||
| """ | ||
| `filter_jobs_by_tag(self, tag)` | ||
@@ -77,2 +85,23 @@ : Retrieves list of job IDs with associated tag. | ||
| `filter_jobs_by_title(self, title): | ||
| """Retrieves list of job IDs with associated title. | ||
| More information https://developer.appen.com/#tag/Account-Info/paths/~1jobs.json/get | ||
| Args: | ||
| title (str): keywords to search for in job title | ||
| Returns: | ||
| list: List of jobs with title | ||
| """ | ||
| `filter_jobs_by_copied_from(self, copied_from): | ||
| """Retrieves list of job IDs with associated copied_from job_id. | ||
| More information https://developer.appen.com/#tag/Account-Info/paths/~1jobs.json/get | ||
| Args: | ||
| copied_from (int): fileter jobs by the job id they were copied from | ||
| Returns: | ||
| list: List of jobs copied from the copied_from_id | ||
| `get_unit_state(self, job_id, unit_id)` | ||
@@ -79,0 +108,0 @@ : Retrieves current unit state within job |
+1
-1
@@ -9,3 +9,3 @@ from setuptools import setup, find_packages | ||
| name='adapapi', | ||
| version='0.0.8', | ||
| version='0.0.9', | ||
| description='A simple Python package using Appen API', | ||
@@ -12,0 +12,0 @@ long_description=long_description, |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
55781
13.39%636
16.48%