Mgmt049 / Comicvine-API-scraper-pub

Python script that scrapes Comicvine REST API endpoint to retrive JSON and download to Excel records
0 stars 0 forks source link

put in a try-catch for if communication is dropped #3

Open Mgmt049 opened 1 year ago

Mgmt049 commented 1 year ago

https://stackoverflow.com/questions/4990718/how-can-i-write-a-try-except-block-that-catches-all-exceptions?rq=1

Mgmt049 commented 1 year ago

This is the error experienced with no comms:

C:\Users\00616891\Downloads\CV_API_output\ execute_get() at 2023-06-19 15:53:36.535661 full query string/endpoint: http://comicvine.gamespot.com/api/characters/?api_key=f4c0a0d5001a93f785b68a8be6ef86f9831d4b5b&sort=name: asc&offset=400&format=json a ConnectionError error occured: HTTPConnectionPool(host='comicvine.gamespot.com', port=80): Max retries exceeded with url: /api/characters/?api_key=f4c0a0d5001a93f785b68a8be6ef86f9831d4b5b&sort=name:%20asc&offset=400&format=json (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0156B238>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

Traceback (most recent call last):

File C:\REPORTS COPY TOOLS\GitHub\Comicvine-API-scraper-pub\ComicvineAPI-scrape-pub.py:297 in make_request df_API_result = self.normalize_df()

File C:\REPORTS COPY TOOLS\GitHub\Comicvine-API-scraper-pub\ComicvineAPI-scrape-pub.py:194 in normalize_df self.df_json_CV = pd.json_normalize(self._CV_processed_json, record_path =['results'],meta=['error', 'limit', 'offset'])

File ~\AppData\Local\Programs\Python\Python39-32\my-project-envs\project-Comicvine-api\lib\site-packages\pandas\io\json_normalize.py:443 in _json_normalize raise NotImplementedError

NotImplementedError