Jump to content

the1gofer

Member
  • Posts

    8
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

the1gofer's Achievements

Helping Hand

Helping Hand (3/5)

0

Reputation

  1. looks like the problem was in the bash script I needed a line break. #!/bin/bash source /Users/jasoncrews/Vault/TCPA/Scripts/'Link Scraper'/venv/bin/activate /Users/jasoncrews/Vault/TCPA/Scripts/'Link Scraper'/venv/bin/python3.9 /Users/jasoncrews/Vault/TCPA/Scripts/'Link Scraper'/phone.py "{query}"
  2. I have a workflow that runs the following bash script #!/bin/bash source /Users/user123/Vault/TCPA/Scripts/'Link Scraper'/venv/bin/activate /Users/user123/Vault/TCPA/Scripts/'Link Scraper'/venv/bin/python3.9 /Users/usr123/Vault/TCPA/Scripts/'Link Scraper'/phone.py "{query}" If I run the bash script from the terminal it works If I run the python script from the terminal it works the keyword passes the query to the bash script but nothing seems to come out the other end of the python script. I've tried having the python script create the file I want, no luck I've tried having alfred create the file, no luck the python script import json import requests import pprint import sys import re class IPQS: key = 'gAZTc419da1PfKwjrIkjgZTPe1BmbKV7' def phone_number_api(self, phonenumber: str, vars: dict = {}) -> dict: url = 'https://www.ipqualityscore.com/api/json/phone/%s/%s' %(self.key, clean_phone_number(phonenumber)) x = requests.get(url, params = vars) return (json.loads(x.text)) def clean_phone_number(phone_number): # Remove the hyphens and parentheses from the phone number stripped_phone_number = phone_number.replace("-", "").replace("(", "").replace(")", "") return stripped_phone_number def dirty_phone_number(phone_number): # Extract the digits from the phone number digits = re.sub(r'\D', '', phone_number) # Format the phone number as (xxx) xxx-xxxx formatted_phone_number = f"({digits[:3]}){digits[3:6]}-{digits[6:]}" return formatted_phone_number if __name__ == "__main__": pp = pprint.PrettyPrinter(indent=4) # Check if a phone number was passed as a command line argument if len(sys.argv) < 2: #print("Usage: python phone.py phone_number") #sys.exit(1) phone = input("Phone: ") else: # Get the phone number from the command line argument phone = clean_phone_number(sys.argv[1]) #Retrieve additional (optional) data points which help us enhance fraud scores and ensure data is processed correctly. countries = {'US', 'CA'}; #custom feilds additional_params = { 'country' : countries } ipqs = IPQS() result = ipqs.phone_number_api(phone, additional_params) yaml = f"""--- carrier: {result["carrier"]} --- """ query = f""" # Notes where this number appears: ```dataview list where contains(callerID, this.file.name) ```""" # Check to see if our query was successful. if 'success' in result and result['success']: # Convert the result to a string result_str = pprint.pformat(result) # Set the save location save_location = f'/Users/user123/Vault/TCPA/1 - Cases/51 - Phone Numbers/{dirty_phone_number(phone)}.md' text = f"""{yaml}\n{result_str}\n{query}""" sys.stdout.write(text)
  3. I'm sorry to have bothered you. I guess I'm to stupid.
  4. I'm afraid I don't understand. I updated #!/bin/bash source "${HOME}/.zshrc" /Path/to/Scripts/'Link Scraper'/venv/bin/activate python /Path/to/Scripts/'Link Scraper'/format_notes.py and #!/bin/bash source "${HOME}/.zshrc" /Path/to/Scripts/'Link Scraper'/venv/bin/activate python3 /Path/to/Scripts/'Link Scraper'/format_notes.py with no effect if I go directly to the terminal, open that venv, then try to install it, it says it's installed. However running the script from the terminal yields the same error. works fin in vs code however with the same venv running. I'm running mac os 13.2.1, on a m1 macbook. Working on it further, it seems like it works in vs code even when it's not in the venv....
  5. according to that, it shouldn't be an issue if I am using the full path, which I am.
  6. I've used this for a while with no issues. Now I'm not sure what has changed, Alfred doesn't seem to want to run the script now. Nothing is wrong with the script itself because I can run it through vs code or my terminal just fine. Here is bash script #!/bin/bash source /Path/to/Scripts/'Link Scraper'/venv/bin/activate python /Path/to/Scripts/'Link Scraper'/format_notes.py Here is the error [11:37:37.411] ERROR: TCPA Tools[Run Script] DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621 DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621 Traceback (most recent call last): File "/Path/to/Scripts/Link Scraper/format_notes.py", line 2, in <module> import pandas as pd ModuleNotFoundError: No module named 'pandas' Pandas is installed because I can run the script in my terminal with the same commands...Any suggestions?
  7. thanks for that. I sent the request, and got the token back. What should i google to learn how to do something with that token. I'll need to send it with the put request to create the watchete.
  8. I would like to have the ability to use Alfred to quickly add urls to watchet. I feel like it's possible, but it might be a bit outside by skill level. I've looked in to zapier integration, using their workflow and post catching guide. But you can't create a watchete with that service. Watchete has an api https://www.wachete.com/api, but no Python wrapper, so I don't think I'd be able to figure out how to manually do it. Any suggesitons?
×
×
  • Create New...