{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from OnetWebService import OnetWebService\n", "import sys\n", "import json\n", "\n", "# read JSON input\n", "input = json.load(sys.stdin)\n", "\n", "# initialize Web Services and results objects\n", "onet_ws = OnetWebService(input['config']['username'], input['config']['password'])\n", "max_results = max(500, input['config']['max_results'])\n", "output = { 'output': [] }\n", "\n", "# call keyword search for each input query\n", "for q in input['queries']:\n", " res = []\n", " kwresults = onet_ws.call('online/search',\n", " ('keyword', q),\n", " ('end', max_results))\n", " if ('occupation' in kwresults) and (0 < len(kwresults['occupation'])):\n", " for occ in kwresults['occupation']:\n", " res.append({ 'code': occ['code'], 'title': occ['title'] })\n", " \n", " output['output'].append({ 'query': q, 'results': res })\n", "\n", "json.dump(output, sys.stdout, indent=2, sort_keys=True)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "from OnetWebService import OnetWebService\n", "import sys\n", "import json\n", "import pandas as pd\n", "from selenium import webdriver\n", "from selenium.webdriver.common.by import By\n", "import time\n", "import spacy" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "# read JSON input\n", "input = json.load(sys.stdin)\n", "#input = pd.read_csv(\"demo.csv\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# initialize Web Services and results objects\n", "onet_ws = OnetWebService(input['config']['username'], input['config']['password'])\n", "max_results = max(500, input['config']['max_results'])\n", "output = { 'output': [] }" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import requests\n", "from bs4 import BeautifulSoup\n", "import json\n", "from selenium import webdriver" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# URL for the occupation details\n", "url = \"https://www.onetonline.org/find/all\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.6" } }, "nbformat": 4, "nbformat_minor": 2 }