|
29 | 29 | "metadata": {
|
30 | 30 | "collapsed": false,
|
31 | 31 | "execution": {
|
32 |
| - "iopub.execute_input": "2025-02-25T03:09:16.810855Z", |
33 |
| - "iopub.status.busy": "2025-02-25T03:09:16.810657Z", |
34 |
| - "iopub.status.idle": "2025-02-25T03:09:17.938183Z", |
35 |
| - "shell.execute_reply": "2025-02-25T03:09:17.937505Z" |
| 32 | + "iopub.execute_input": "2025-02-26T03:36:06.769536Z", |
| 33 | + "iopub.status.busy": "2025-02-26T03:36:06.769131Z", |
| 34 | + "iopub.status.idle": "2025-02-26T03:36:07.934020Z", |
| 35 | + "shell.execute_reply": "2025-02-26T03:36:07.933257Z" |
36 | 36 | }
|
37 | 37 | },
|
38 | 38 | "outputs": [
|
|
41 | 41 | "output_type": "stream",
|
42 | 42 | "text": [
|
43 | 43 | "Collecting python-frontmatter\r\n",
|
44 |
| - " Downloading python_frontmatter-1.1.0-py3-none-any.whl.metadata (4.1 kB)\r\n" |
| 44 | + " Downloading python_frontmatter-1.1.0-py3-none-any.whl.metadata (4.1 kB)\r\n", |
| 45 | + "Requirement already satisfied: getorg in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (0.3.1)\r\n" |
45 | 46 | ]
|
46 | 47 | },
|
47 | 48 | {
|
48 | 49 | "name": "stdout",
|
49 | 50 | "output_type": "stream",
|
50 | 51 | "text": [
|
51 |
| - "Requirement already satisfied: getorg in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (0.3.1)\r\n", |
52 | 52 | "Requirement already satisfied: PyYAML in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from python-frontmatter) (6.0.2)\r\n",
|
53 | 53 | "Requirement already satisfied: geopy in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from getorg) (2.4.1)\r\n",
|
54 | 54 | "Requirement already satisfied: pygithub in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from getorg) (2.6.1)\r\n",
|
|
60 | 60 | "Requirement already satisfied: typing-extensions>=4.0.0 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from pygithub->getorg) (4.12.2)\r\n",
|
61 | 61 | "Requirement already satisfied: urllib3>=1.26.0 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from pygithub->getorg) (2.3.0)\r\n",
|
62 | 62 | "Requirement already satisfied: Deprecated in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from pygithub->getorg) (1.2.18)\r\n",
|
63 |
| - "Requirement already satisfied: six>=1.7.0 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from retrying->getorg) (1.17.0)\r\n" |
| 63 | + "Requirement already satisfied: six>=1.7.0 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from retrying->getorg) (1.17.0)\r\n", |
| 64 | + "Requirement already satisfied: cryptography>=3.4.0 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from pyjwt[crypto]>=2.4.0->pygithub->getorg) (44.0.1)\r\n", |
| 65 | + "Requirement already satisfied: cffi>=1.4.1 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from pynacl>=1.4.0->pygithub->getorg) (1.17.1)\r\n", |
| 66 | + "Requirement already satisfied: charset-normalizer<4,>=2 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from requests>=2.14.0->pygithub->getorg) (3.4.1)\r\n", |
| 67 | + "Requirement already satisfied: idna<4,>=2.5 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from requests>=2.14.0->pygithub->getorg) (3.10)\r\n", |
| 68 | + "Requirement already satisfied: certifi>=2017.4.17 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from requests>=2.14.0->pygithub->getorg) (2025.1.31)\r\n", |
| 69 | + "Requirement already satisfied: wrapt<2,>=1.10 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from Deprecated->pygithub->getorg) (1.17.2)\r\n" |
64 | 70 | ]
|
65 | 71 | },
|
66 | 72 | {
|
67 | 73 | "name": "stdout",
|
68 | 74 | "output_type": "stream",
|
69 | 75 | "text": [
|
70 |
| - "Requirement already satisfied: cryptography>=3.4.0 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from pyjwt[crypto]>=2.4.0->pygithub->getorg) (44.0.1)\r\n", |
71 |
| - "Requirement already satisfied: cffi>=1.4.1 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from pynacl>=1.4.0->pygithub->getorg) (1.17.1)\r\n", |
72 |
| - "Requirement already satisfied: charset-normalizer<4,>=2 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from requests>=2.14.0->pygithub->getorg) (3.4.1)\r\n", |
73 |
| - "Requirement already satisfied: idna<4,>=2.5 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from requests>=2.14.0->pygithub->getorg) (3.10)\r\n", |
74 |
| - "Requirement already satisfied: certifi>=2017.4.17 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from requests>=2.14.0->pygithub->getorg) (2025.1.31)\r\n", |
75 |
| - "Requirement already satisfied: wrapt<2,>=1.10 in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from Deprecated->pygithub->getorg) (1.17.2)\r\n", |
76 | 76 | "Requirement already satisfied: pycparser in /opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/site-packages (from cffi>=1.4.1->pynacl>=1.4.0->pygithub->getorg) (2.22)\r\n",
|
77 | 77 | "Downloading python_frontmatter-1.1.0-py3-none-any.whl (9.8 kB)\r\n"
|
78 | 78 | ]
|
|
81 | 81 | "name": "stdout",
|
82 | 82 | "output_type": "stream",
|
83 | 83 | "text": [
|
84 |
| - "Installing collected packages: python-frontmatter\r\n", |
| 84 | + "Installing collected packages: python-frontmatter\r\n" |
| 85 | + ] |
| 86 | + }, |
| 87 | + { |
| 88 | + "name": "stdout", |
| 89 | + "output_type": "stream", |
| 90 | + "text": [ |
85 | 91 | "Successfully installed python-frontmatter-1.1.0\r\n"
|
86 | 92 | ]
|
87 | 93 | },
|
|
103 | 109 | "import frontmatter\n",
|
104 | 110 | "import glob\n",
|
105 | 111 | "import getorg\n",
|
106 |
| - "from geopy import Nominatim" |
| 112 | + "from geopy import Nominatim\n", |
| 113 | + "from geopy.exc import GeocoderTimedOut" |
107 | 114 | ]
|
108 | 115 | },
|
109 | 116 | {
|
|
112 | 119 | "metadata": {
|
113 | 120 | "collapsed": false,
|
114 | 121 | "execution": {
|
115 |
| - "iopub.execute_input": "2025-02-25T03:09:17.940290Z", |
116 |
| - "iopub.status.busy": "2025-02-25T03:09:17.940054Z", |
117 |
| - "iopub.status.idle": "2025-02-25T03:09:17.943342Z", |
118 |
| - "shell.execute_reply": "2025-02-25T03:09:17.942828Z" |
| 122 | + "iopub.execute_input": "2025-02-26T03:36:07.936149Z", |
| 123 | + "iopub.status.busy": "2025-02-26T03:36:07.935901Z", |
| 124 | + "iopub.status.idle": "2025-02-26T03:36:07.939314Z", |
| 125 | + "shell.execute_reply": "2025-02-26T03:36:07.938765Z" |
119 | 126 | }
|
120 | 127 | },
|
121 | 128 | "outputs": [],
|
|
130 | 137 | "metadata": {
|
131 | 138 | "collapsed": true,
|
132 | 139 | "execution": {
|
133 |
| - "iopub.execute_input": "2025-02-25T03:09:17.945196Z", |
134 |
| - "iopub.status.busy": "2025-02-25T03:09:17.945010Z", |
135 |
| - "iopub.status.idle": "2025-02-25T03:09:17.969546Z", |
136 |
| - "shell.execute_reply": "2025-02-25T03:09:17.969023Z" |
| 140 | + "iopub.execute_input": "2025-02-26T03:36:07.941580Z", |
| 141 | + "iopub.status.busy": "2025-02-26T03:36:07.941049Z", |
| 142 | + "iopub.status.idle": "2025-02-26T03:36:07.966143Z", |
| 143 | + "shell.execute_reply": "2025-02-26T03:36:07.965594Z" |
137 | 144 | }
|
138 | 145 | },
|
139 | 146 | "outputs": [],
|
140 | 147 | "source": [
|
| 148 | + "# Set the default timeout, in seconds\n", |
| 149 | + "TIMEOUT = 5\n", |
| 150 | + "\n", |
141 | 151 | "# Prepare to geolocate\n",
|
142 | 152 | "geocoder = Nominatim(user_agent=\"academicpages.github.io\")\n",
|
143 | 153 | "location_dict = {}\n",
|
|
159 | 169 | "metadata": {
|
160 | 170 | "collapsed": false,
|
161 | 171 | "execution": {
|
162 |
| - "iopub.execute_input": "2025-02-25T03:09:17.971475Z", |
163 |
| - "iopub.status.busy": "2025-02-25T03:09:17.971291Z", |
164 |
| - "iopub.status.idle": "2025-02-25T03:09:23.694311Z", |
165 |
| - "shell.execute_reply": "2025-02-25T03:09:23.693697Z" |
| 172 | + "iopub.execute_input": "2025-02-26T03:36:07.968167Z", |
| 173 | + "iopub.status.busy": "2025-02-26T03:36:07.967976Z", |
| 174 | + "iopub.status.idle": "2025-02-26T03:36:11.603488Z", |
| 175 | + "shell.execute_reply": "2025-02-26T03:36:11.602744Z" |
166 | 176 | }
|
167 | 177 | },
|
168 | 178 | "outputs": [
|
|
184 | 194 | "name": "stdout",
|
185 | 195 | "output_type": "stream",
|
186 | 196 | "text": [
|
187 |
| - "Talk 1 on Relevant Topic in Your Field<br />UC San Francisco, Department of Testing; San Francisco, CA, USA San Francisco, California, United States\n" |
| 197 | + "Conference Proceeding talk 3 on Relevant Topic in Your Field<br />Testing Institute of America 2014 Annual Conference; Los Angeles, CA, USA Los Angeles, Los Angeles County, California, United States\n" |
188 | 198 | ]
|
189 | 199 | },
|
190 | 200 | {
|
191 | 201 | "name": "stdout",
|
192 | 202 | "output_type": "stream",
|
193 | 203 | "text": [
|
194 |
| - "Conference Proceeding talk 3 on Relevant Topic in Your Field<br />Testing Institute of America 2014 Annual Conference; Los Angeles, CA, USA Los Angeles, Los Angeles County, California, United States\n" |
| 204 | + "Talk 1 on Relevant Topic in Your Field<br />UC San Francisco, Department of Testing; San Francisco, CA, USA San Francisco, California, United States\n" |
195 | 205 | ]
|
196 | 206 | }
|
197 | 207 | ],
|
|
213 | 223 | " description = f\"{title}<br />{venue}; {location}\"\n",
|
214 | 224 | "\n",
|
215 | 225 | " # Geocode the location and report the status\n",
|
216 |
| - " location_dict[description] = geocoder.geocode(location)\n", |
217 |
| - " print(description, location_dict[description])" |
| 226 | + " try:\n", |
| 227 | + " location_dict[description] = geocoder.geocode(location, timeout=TIMEOUT)\n", |
| 228 | + " print(description, location_dict[description])\n", |
| 229 | + " except ValueError as ex:\n", |
| 230 | + " print(f\"Error: geocode failed on input {location} with message {ex}\")\n", |
| 231 | + " except GeocoderTimedOut as ex:\n", |
| 232 | + " print(f\"Error: geocode timed out on input {location} with message {ex}\")\n", |
| 233 | + " except Exception as ex:\n", |
| 234 | + " print(f\"An unhandled exception occurred while processing input {location} with message {ex}\")" |
218 | 235 | ]
|
219 | 236 | },
|
220 | 237 | {
|
|
223 | 240 | "metadata": {
|
224 | 241 | "collapsed": false,
|
225 | 242 | "execution": {
|
226 |
| - "iopub.execute_input": "2025-02-25T03:09:23.696332Z", |
227 |
| - "iopub.status.busy": "2025-02-25T03:09:23.696137Z", |
228 |
| - "iopub.status.idle": "2025-02-25T03:09:23.704293Z", |
229 |
| - "shell.execute_reply": "2025-02-25T03:09:23.703718Z" |
| 243 | + "iopub.execute_input": "2025-02-26T03:36:11.605607Z", |
| 244 | + "iopub.status.busy": "2025-02-26T03:36:11.605411Z", |
| 245 | + "iopub.status.idle": "2025-02-26T03:36:11.613528Z", |
| 246 | + "shell.execute_reply": "2025-02-26T03:36:11.612932Z" |
230 | 247 | }
|
231 | 248 | },
|
232 | 249 | "outputs": [
|
|
0 commit comments