May-14-2023, 10:09 PM
I'm using this code for a while and it worked well:
But the problem is that when I came back to it after a month it doesn't work. it show me this error:
Traceback (most recent call last):
File "C:\Users\LENOVO\Documents\Custom\domaines\lab\already sold finish\ok.py", line 59, in <module>
appraisal_res = requests.get(appraisal.format(domain), headers=headers).json()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[Finished in 948ms]
What other ways can use to call the api if this line is no more working?
I changed my API but same issue
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# This is needed to send POST and GET requests import requests import csv import numpy import random # Godaddy developer key and secret api_key = "##########################" secret_key = "######################" # API key and secret are sent in the header headers = { "Authorization" : "sso-key {}:{}" . format (api_key, secret_key)} # Domain availability and appraisal end points # This list holds similar domains sold # This is retrieved from Godaddy appraisal API similar_domains = [] domain = [] # This holds available domains found that match # the search criteria found_domains = {} # Open prefix, keyword, suffix and extension from files with open ( "keyword.txt" ) as f: keywords = f.read().splitlines() # csv file with open ( "results.csv" , "w" , newline = "") as file : writer = csv.writer( file ) writer.writerow([ "domain" , "similar domain" , "price" , "year" ]) # Filter similar sold domains by sale price and year for domain in keywords: # Call appraisl API appraisal_res = requests.get(appraisal. format (domain), headers = headers).json() # Do not abuse the API #time.sleep(2) delays = [ 3 , 5 , 7 , 4 , 4 , 11 ] time.sleep(numpy.random.choice(delays)) comparable_sales = appraisal_res[ "comparable_sales" ][ 0 ] writer.writerow([domain, comparable_sales[ "domain" ], comparable_sales[ "price" ], comparable_sales[ "year" ]]) print ( f "{domain}" ) |
Traceback (most recent call last):
File "C:\Users\LENOVO\Documents\Custom\domaines\lab\already sold finish\ok.py", line 59, in <module>
appraisal_res = requests.get(appraisal.format(domain), headers=headers).json()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[Finished in 948ms]
What other ways can use to call the api if this line is no more working?
I changed my API but same issue