Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ptwobrussell/7191167 to your computer and use it in GitHub Desktop.
Save ptwobrussell/7191167 to your computer and use it in GitHub Desktop.
If you are running on a hosted AWS VM provided for the Strata workshop, you'll need to use the following approach to follow along with Example 6 and on, because you aren't using Vagrant and won't have another way to copy your data onto the remote machine. All you'll need to do is create a new cell in the "Chapter 3 (Mining LinkedIn)" IPython Not…
# On a remote AWS VM, you'll need to create and save your
# CSV connections to the the remote VM before executing Example 6
# since you're not using Vagrant (and since we won't be using SSH
# as part of the workshop.)
# Copy/paste your connections (or a large subset of them) into a string value
# that's bounded by triple quotes like the following example (which defines only
# a single contact for brevity.)
csv_as_string = \
"""
"Title","First Name","Middle Name","Last Name","Suffix","E-mail Address","E-mail 2 Address","E-mail 3 Address","Business Street","Business Street 2","Business Street 3","Business City","Business State","Business Postal Code","Business Country","Home Street","Home Street 2","Home Street 3","Home City","Home State","Home Postal Code","Home Country","Other Street","Other Street 2","Other Street 3","Other City","Other State","Other Postal Code","Other Country","Company","Department","Job Title","Assistant's Phone","Business Fax","Business Phone","Business Phone 2","Callback","Car Phone","Company Main Phone","Home Fax","Home Phone","Home Phone 2","ISDN","Mobile Phone","Other Fax","Other Phone","Pager","Primary Phone","Radio Phone","TTY/TDD Phone","Telex","Assistant's Name","Birthday","Manager's Name","Notes","Other Address PO Box","Spouse","Web Page","Personal Web Page"
"","Matthew","A.","Russell","","ptwobrussell@example.com","","","","","","","","","","","","","","","","","","","","","","","","Digital Reasoning","","Chief Technical Officer","","","","","","","","","","","","","","","","","","","","","","","","","","",""
""".strip()
# Save the data to a file at the proper location like this
CSV_FILE = os.path.join("resources", "ch03-linkedin", 'my_connections.csv')
with open(CSV_FILE, 'w') as f:
f.write(csv_as_string)
# You can test whether the file was written properly by reading it back out,
# which is exactly what the next example will do.
CSV_FILE = os.path.join("resources", "ch03-linkedin", 'my_connections.csv')
with open(CSV_FILE) as f:
print f.readlines()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment