forked from rsdoiel/archivesspace-api-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path20-ArchivesSpace-API-Workshop.html
39 lines (31 loc) · 1.2 KB
/
20-ArchivesSpace-API-Workshop.html
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
<!DOCTYPE html>
<html>
<head>
<link href="css/slides.css" rel="stylesheet" />
</head>
<body>
<nav>
<a id="start-slide" rel="nav" href="00-ArchivesSpace-API-Workshop.html" title="Return to start of presentation">Start</a>
<a id="prev-slide" rel="nav" href="19-ArchivesSpace-API-Workshop.html" title="Previous slide">Prev</a>
<a id="next-slide" rel="nav" href="21-ArchivesSpace-API-Workshop.html" title="Next slide">Next</a>
</nav>
<section><h1>2. Make an http connection</h1>
<h2>Putting it all together</h2>
<p>Let’s take what we learned and create a Python script called
<a href="make-an-http-connection.py">make-an-http-connection.py</a>.</p>
<pre><code class="language-python"> #!/usr/bin/env python3
import urllib.request
api_url = input('ArchivesSpace API URL: ')
req = urllib.request.Request(api_url)
response = urllib.request.urlopen(req)
print(response.read().decode('utf-8'))
</code></pre>
<ol>
<li>In IDLE click on the file name and create a new file</li>
<li>Type in the above</li>
<li>Save the file as <a href="make-an-http-connection.py">make-an-http-connection.py</a></li>
</ol>
</section>
<script type="text/javascript" src="js/keyboard-nav.js"></script>
</body>
</html>