automated terminal push
This commit is contained in:
73
fetchjobs.py
Normal file
73
fetchjobs.py
Normal file
@@ -0,0 +1,73 @@
|
||||
import csv
|
||||
|
||||
import json
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from jobspy import scrape_jobs
|
||||
|
||||
def dowork():
|
||||
|
||||
jobs = scrape_jobs(
|
||||
|
||||
site_name=["indeed", "linkedin", "zip_recruiter", "glassdoor", "google"],
|
||||
|
||||
search_term="Devops",
|
||||
|
||||
google_search_term="Remote Devops jobs near miami, florida",
|
||||
|
||||
location="miami, fl",
|
||||
|
||||
results_wanted=50,
|
||||
|
||||
hours_old=72, # (only Linkedin/Indeed is hour specific, others round up to days old)
|
||||
|
||||
country_indeed='USA', # only needed for indeed / glassdoor
|
||||
|
||||
)
|
||||
|
||||
print(f"scraper seearch completed. found {len(jobs)} jobs.")
|
||||
|
||||
print(jobs.head())
|
||||
|
||||
# Convert DataFrame to JSON string
|
||||
json_string = jobs.to_json(orient='records')
|
||||
|
||||
print("json",json_string)
|
||||
|
||||
|
||||
# jobs.to_csv("shinob-jobs-report.csv", quoting=csv.QUOTE_NONNUMERIC, escapechar="\\", index=False, sep='|' )
|
||||
|
||||
return json_string
|
||||
|
||||
def writeFile( variable_value):
|
||||
|
||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||
|
||||
filename = f"shinobi-jobs-report.json"
|
||||
|
||||
with open(filename, "w") as f:
|
||||
|
||||
f.write(str(variable_value))
|
||||
|
||||
def read():
|
||||
|
||||
filename = "shinobi-jobs-report.json"
|
||||
|
||||
try:
|
||||
|
||||
with open(filename, "r") as f:
|
||||
|
||||
return f.read()
|
||||
|
||||
except FileNotFoundError:
|
||||
|
||||
print(f"Error: File '{filename}' not found.")
|
||||
|
||||
return None
|
||||
|
||||
#thing = dowork()
|
||||
|
||||
#print("thing: ",thing)
|
||||
|
||||
#writeFile(thing)
|
Reference in New Issue
Block a user