{"id":15797476,"url":"https://github.com/james-see/python-examples","last_synced_at":"2025-08-09T06:27:20.823Z","repository":{"id":32209005,"uuid":"35782788","full_name":"james-see/python-examples","owner":"james-see","description":"Examples for some key libraries in Python that I use all the time. A way for me to remember and hopefully get others started. ","archived":false,"fork":false,"pushed_at":"2024-07-15T19:32:23.000Z","size":92097,"stargazers_count":44,"open_issues_count":7,"forks_count":26,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-30T15:22:31.452Z","etag":null,"topics":["examples","examples-python","python","python3","training-materials"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/james-see.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-05-17T21:00:44.000Z","updated_at":"2025-02-17T00:06:31.000Z","dependencies_parsed_at":"2024-04-15T06:11:34.158Z","dependency_job_id":"f4f34880-e632-4c5d-ab45-57f901fda1c4","html_url":"https://github.com/james-see/python-examples","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/james-see/python-examples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james-see%2Fpython-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james-see%2Fpython-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james-see%2Fpython-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james-see%2Fpython-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/james-see","download_url":"https://codeload.github.com/james-see/python-examples/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james-see%2Fpython-examples/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261621748,"owners_count":23185787,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["examples","examples-python","python","python3","training-materials"],"created_at":"2024-10-05T00:08:45.738Z","updated_at":"2025-06-24T06:35:13.046Z","avatar_url":"https://github.com/james-see.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# python-examples\n\n\u003ca href='https://travis-ci.org/jamesacampbell/python-examples'\u003e![travis build status](https://travis-ci.org/jamesacampbell/python-examples.svg)\u003c/a\u003e\n[![CircleCI](https://circleci.com/gh/jamesacampbell/python-examples/tree/master.svg?style=svg)](https://circleci.com/gh/jamesacampbell/python-examples/tree/master)\n\nThis is a collection of python examples I created for some key libraries in Python that I use all the time.\n\nIt is a way for me to remember and hopefully get others started.\n\nStart your Python journey in Python 3. Onward and upward.\n\n**urllib** (built-in to python3)\n\n1. [access foursquare API](#foursquare-api-example)\n\n## *By python 3.x package:*\n\n**http.server** (built-in to python3)\n\n1. [http example](#http-example)\n\n**pdfquery** (install by `pip3 install pdfquery --upgrade`)\n\n1. [pdfquery example](#pdfquery-example)\n\n**PyPDF2** (install by `pip3 install PyPDF2 --upgrade`)\n\n1. [pdf merge example](#pdf-merge-example)\n\n**argparse** (install by `pip3 install argparse --upgrade`)\n\n1. [argparse example](#argparse-example)\n\n**bs4** ([package download link](http://www.crummy.com/software/BeautifulSoup/bs4/download/))\n\n1. [html to text parser](#html-to-text-example)\n2. [email parser](#email-parser-example)\n\n**fuzzywuzzy** (install by `pip3 install fuzzywuzzy --upgrade`)\n\n1. [fuzzywuzzy](#fuzzywuzzy-example)\n\n**rethinkdb** (install by `pip3 install rethinkdb --upgrade`)\n\n1. [rethinkdb example](#rethinkdb-example)\n\n**quandl** (install by `pip3 install quandl --upgrade`)\n\n1. [quandl api access example](#quandl-example)\n\n**hug** (install by `pip3 install hug --upgrade`)\n\n1. [hug api access example](#hug-example)\n\n**base64** (package is built-in)\n\n1. [base64 encode \u0026 decode example](#base64-example)\n\n**http.server** (package is built-in)\n\n1. [web server example](#server-example)\n\n**hashlib** (package is built-in)\n\n1. [sha 256 hash example](#sha-example)\n\n**nltk** (package download via pip3 install nltk)\n\n1. [sentiment analysis example](#sentiment-example)\n\n**exifread** (package download via pip3 install exifread)\n\n1. [read exif example](#exifread-example)\n\n**json** (package download via pip3 install json)\n\n1. [json to python object example](#json-to-python-object-example)\n\n**urllib3** (package download via pip3 install urllib3 from homebrew osx brew install python3)\n\n1. [google mask search example](#google-mask-example)\n2. [urllib3 proxymanager example](#proxymanager-example)\n\n**blockchain** (package download via pip3 install blockchain)\n\n1. [wallet query example](#bitcoin-wallet-example)\n\n**PySocks** ([package download link](https://github.com/Anorov/PySocks))\n\n 1. [connect to tor and print .onion site](#tor-connect-example)\n\n**shodan** (package download via pip install shodan)\n\n1. [shodan count example](#shodan-count-example)\n2. [google lat/long and shodan enrichment geo search example](#google-geo-and-shodan-example)\n\n**websockify** (package download via pip(3) install websockify)\n\n1. [websockify example](#websockify-example)\n\n**scrapy** ([package download link](http://scrapy.org/download/))\n\n1. [crawl all internal links for a domain](#scrapy-spider-example)\n\n**iptcinfo3** (download via pip3 install iptcinfo3)\n\n1. [iptcinfo3 example](#iptcinfo3-example)\n\n**imaplib** (build-in python3x)\n\n1. [imaplib example](#imaplib-example)\n\n## http.server Example\n\nThis example runs a web server to http://127.0.0.1:8000. Go to http://127.0.0.1:8000/web.html to verify it is working.\n\n#### Run the example\n\n```python3\npython3 example-http-server.py\n```\n\nThis will output that it is running on port 8000.\n\n## pdfquery Example\n\nThis example takes in the first argument the name of the pdf you want to get text from and prints the text found in the pdf to the screen.\n\n### Run the example\n\n```python3\npython3 pdfquery-example.py mypdf.pdf\n```\n\nThis will output the text of the pdf to stdout if it contains any.\n\n## PDF Merge Example\n\nThis example reads in a list of pdfs, you can specify the prefix of the list of pdfs using the `-p` argument or default is read\\_. So for example, read_001.pdf, read_002.pdf would automatically get merged into a single pdf called merged.pdf. You can also set the output name via the `-o` argument.\n\n### Run the example\n\nTo get the help file:\n\n```python3\npython3 merge-pdfs-example.py -h\n```\n\nTo run it on a list of pdfs with prefix `test` and output `final.pdf`:\n\n```python3\npython3 merge-pdfs-example.py -p test -o final.pdf\n```\n\n## Pattern Twitter Search Example\n\nThe first example I created is pattern-example-twitter.py. Pattern is a great library that is installed via pip and can query Google, Twitter, etc. out of the box.\n\nThis twitter example connects to twitter and searches either a random string or terms you set via the terminal with the -s 'search terms'.\n\nTerminal Example\n\n```python3\npython3 pattern-example-twitter.py -s 'Hello World'\n```\n\n## Tor Connect Example\n\nTor (The Onion Router) has a particular socks port and connection setup that needs configured to connect in Python. This example shows you how. You must already have [Tor](http://torproject.org/download) installed.\n\n*Note:* You need to install the Socksipy package for this to work, which has an actively maintained fork in [PySocks](https://github.com/Anorov/PySocks). It is easy if you already have pip (and if you don't have pip you should). \u003ccode\u003e$ pip install PySocks\u003c/code\u003e\n\nThen make sure your code (like the example) has \u003ccode\u003eimport socks\u003c/code\u003e.\n\n### Run the tor connect example\n\nJust simply run it from the terminal window:\n\n```python3\npython tor-example.py\n```\n\nThis will return the DuckDuckGo .onion html as proof that it is working.\n\n## Google Search Example\n\nThe Google seach portion of the pattern library was very useful. This example shows you that you can compare the popularity of phrases or sets of terms together using percentages and the sort() command. It selects 10 random words to search on from the imported included dictionary list that is in the assets folder. This doesn't work anymore. Thanks for nothing Google.\n\n### Run the example\n\n```python3\npython3 pattern-example-google.py -c 'sexy'\n```\n\nReturns:\n\n```python3\n89.13% \"sexy seemed\"\n2.17% \"sexy impassive\"\n1.09% \"sexy spiegels\"\n1.09% \"sexy slumping\"\n1.09% \"sexy quietuses\"\n1.09% \"sexy noncooperation\"\n1.09% \"sexy miriness\"\n1.09% \"sexy incompliancy\"\n1.09% \"sexy evaporators\"\n1.09% \"sexy cudgeler\"\u003c/code\u003e\n```\n\n## hug example\n\nhug is a great easy-to-use api to help route things on your web app\n\n### Run the example\n\n```python3\npython3 hug_api_example.py\n```\n\nThis will output hug and start a listener process on 127.0.0.1:8000\n\nThen you can go to http://localhost:8000/happy_birthday?name=Hug\u0026age=1 and see the output.\n\n## base64 Example\n\nConverting data to base64 ensure a nice obsfuscation layer for data transport.\n\n### Run the base64 example\n\n```python3\npython3 base64_example.py\n```\n\nThis will output a html string that is encoded into base64.\n\n## Html to Text Example\n\nBeautiful Soup is a great library to parse and select html or iterate through the DOM.\nFor this example to work you need to install Beautiful Soup via pip:\n\n```python3\npip install bs4\n```\n\n### Run the Example\n\n```python3\npython3 example-html2plaintext.py\n```\n\n#### Returns\n\n```python3\n[*-*]Before html with text:\n------------------\n\u003c!DOCTYPE HTML\u003e\n\u003chead\u003e\n\u003ctitle\u003eTHIS IS AN EXAMPLE by @jamescampbell\u003c/title\u003e\n\u003cmeta author='jamescampbell'\u003e\n\u003cstyle\u003ea {font-family:arial;}\u003c/style\u003e\n\u003c/head\u003e\u003cbody\u003e\n\u003ch1\u003eHello World\u003c/h1\u003e\n\u003cp\u003eI hope you enjoy this example.\u003c/p\u003e\u003c/body\u003e\n------------------\n\n\n\n[*-*]After cleanMe() function:\n-------------------\nTHIS IS AN EXAMPLE by @jamescampbell\nHello World\nI hope you enjoy this example.\n-------------------\n```\n\n## FuzzyWuzzy Example\n\nThis example searches for 'cowboy' and returns Dallas Cowboys as the closest match from the list available.\n\n### Run the Example\n\n```python3\npython3 fuzzywuzzy-example.py\n```\n\n#### Returns\n\n```python3\nDallas Cowboys, 90\n```\n\n## Google Mask Example\n\nThis example used to do three things, 1. sets your search term, 2 . set your number of mask search terms, and 3. selects a random user agent for each search query. Google killed their API for this, so byebye.\n\n### Run the Example\n\n```python3\ndoesn't work anymore because google killed their API\n```\n\n## Server Example\n\nThis example starts an http server on localhost:10010 and returns data when you visit the page\n\n### Run the Example\n\n```python3\npython3 server-example.py\n```\n\n## Scrapy Spider Example\n\nThis example gets the list of all internal links for any domain by following all internal homepage links and their links.\n\n### Run the Example\n\n```python3\npython3 spider.py -u jamescampbell.us\n```\n\n## Bitcoin Wallet Example\n\nThis example queries the blockchain.info API for an example wallet address and returns the ip address and dates for the transactions as well as the final wallet balance.\n\n### Run the Example\n\n```python3\npython3 bitcoin-example-1.py\n```\n\n## Exifread Example\n\nThis example gets the exif data from an image file\n\n### Run the Example\n\n```python3\npython3 exif-reader.py assets/cat.jpg\n```\n\n#### Output\n\n```python3\nTotal tags found: 66\nKey: Interoperability InteroperabilityVersion, value [48, 49, 48, 48]\nKey: EXIF InteroperabilityOffset, value 36724\nKey: Image Software, value SLT-A57 v1.02\nKey: EXIF UserComment, value [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\nKey: Image Orientation, value Horizontal (normal)\nKey: Thumbnail JPEGInterchangeFormat, value 37012\nKey: Interoperability InteroperabilityIndex, value R98\nKey: Image ResolutionUnit, value Pixels/Inch\nKey: EXIF ExifImageWidth, value 4912\nKey: EXIF ComponentsConfiguration, value YCbCr\nKey: EXIF FNumber, value 28/5\nKey: Thumbnail Software, value SLT-A57 v1.02\nKey: EXIF DateTimeDigitized, value 2013:04:07 14:13:38\nKey: EXIF ExposureProgram, value Aperture Priority\nKey: EXIF DateTimeOriginal, value 2013:04:07 14:13:38\nKey: EXIF Sharpness, value Normal\nKey: EXIF RecommendedExposureIndex, value 3200\nKey: EXIF MakerNote, value [83, 79, 78, 89, 32, 68, 83, 67, 32, 0, 0, 0, 78, 0, 3, 16, 4, 0, 16, 0, ... ]\nKey: EXIF CustomRendered, value Normal\nKey: EXIF Saturation, value Normal\nKey: EXIF ExposureTime, value 1/80\nKey: Image Make, value SONY\nKey: EXIF ExifImageLength, value 3264\nKey: EXIF DigitalZoomRatio, value 1\nKey: Image Model, value SLT-A57\nKey: EXIF Contrast, value Normal\nKey: EXIF SensitivityType, value Recommended Exposure Index\nKey: Thumbnail Orientation, value Horizontal (normal)\nKey: Thumbnail YResolution, value 72\nKey: Thumbnail Model, value SLT-A57\nKey: Image PrintIM, value [80, 114, 105, 110, 116, 73, 77, 0, 48, 51, 48, 48, 0, 0, 3, 0, 2, 0, 1, 0, ... ]\nKey: Thumbnail Make, value SONY\nKey: EXIF CompressedBitsPerPixel, value 2\nKey: EXIF MeteringMode, value Pattern\nKey: EXIF MaxApertureValue, value 49/32\nKey: Image YCbCrPositioning, value Co-sited\nKey: EXIF BrightnessValue, value 303/320\nKey: EXIF FlashPixVersion, value 0100\nKey: EXIF WhiteBalance, value Auto\nKey: EXIF LensModel, value 50mm F1.7\nKey: Thumbnail YCbCrPositioning, value Co-sited\nKey: Image DateTime, value 2013:04:07 14:13:38\nKey: EXIF ExifVersion, value 0230\nKey: Thumbnail ImageDescription, value\nKey: Image ExifOffset, value 360\nKey: Thumbnail JPEGInterchangeFormatLength, value 7654\nKey: EXIF ExposureMode, value Auto Bracket\nKey: EXIF SceneType, value Directly Photographed\nKey: EXIF LensSpecification, value [50, 50, 17/10, 17/10]\nKey: Image XResolution, value 350\nKey: EXIF ExposureBiasValue, value 0\nKey: EXIF ColorSpace, value sRGB\nKey: EXIF ISOSpeedRatings, value 3200\nKey: EXIF SceneCaptureType, value Standard\nKey: EXIF FocalLengthIn35mmFilm, value 75\nKey: Image YResolution, value 350\nKey: Thumbnail DateTime, value 2013:04:07 14:13:38\nKey: EXIF FocalLength, value 50\nKey: Thumbnail Compression, value JPEG (old-style)\nKey: EXIF FileSource, value Digital Camera\nKey: EXIF Flash, value Flash did not fire, compulsory flash mode\nKey: Image ImageDescription, value\nKey: Thumbnail XResolution, value 72\nKey: Thumbnail ResolutionUnit, value Pixels/Inch\nKey: EXIF LightSource, value Unknown\n```\n\n## Sentiment Example\n\nThis example takes a test list of tweets and returns positive or negative. It works in Python 3.\n\n### Run the Example\n\n```python3\npython3 sentiment-analysis-nltk-example.py testtweets.txt\n```\n\n### Output\n\n```python3\nnegative\npositive\nnegative\npositive\nnegative\nPositive count: 2\nNegative count: 3\n```\n\n## hashlib example\n\nThe hashlib package generates hashes from strings. This example uses the sha256 hash algorithm.\n\n### Run the Example\n\n```python3\npython3 hashlib_example.py\n```\n\n## Proxymanager Example\n\nThis example uses urllib3 in Python 3 to connect through a privoxy connection and return status, headers, and content.\n\n### Run the Example\n\n```python3\npython3 urllib3-proxymanager-example.py\n```\n\n#### Output\n\n```python3\n200\nHTTPHeaderDict({'Content-Length': '5255', 'Proxy-Connection': 'keep-alive', 'ETag': '\"564e8118-1487\"', 'Server': 'nginx', 'Cache-Control': 'no-cache', 'Expires': 'Fri, 20 Nov 2015 02:15:59 GMT', 'Accept-Ranges': 'bytes', 'Content-Type': 'text/html; charset=UTF-8', 'Connection': 'keep-alive', 'Date': 'Fri, 20 Nov 2015 02:16:00 GMT'})\n\u003c!DOCTYPE html\u003e\n\u003c!--[if IEMobile 7 ]\u003e \u003chtml lang=\"en_US\" class=\"no-js iem7\"\u003e \u003c![endif]--\u003e\n\u003c!--[if lt IE 7]\u003e \u003chtml class=\"ie6 lt-ie10 lt-ie9 lt-ie8 lt-ie7 no-js\" lang=\"en_US\"\u003e \u003c![endif]--\u003e\n\u003c!--[if IE 7]\u003e    \u003chtml class=\"ie7 lt-ie10 lt-ie9 lt-ie8 no-js\" lang=\"en_US\"\u003e \u003c![endif]--\u003e\n\u003c!--[if IE 8]\u003e    \u003chtml class=\"ie8 lt-ie10 lt-ie9 no-js\" lang=\"en_US\"\u003e \u003c![endif]--\u003e\n\u003c!--[if IE 9]\u003e    \u003chtml class=\"ie9 lt-ie10 no-js\" lang=\"en_US\"\u003e \u003c![endif]--\u003e\n\u003c!--[if (gte IE 9)|(gt IEMobile 7)|!(IEMobile)|!(IE)]\u003e\u003c!--\u003e\u003chtml class=\"no-js\" lang=\"en_US\"\u003e\u003c!--\u003c![endif]--\u003e\n\n  \u003chead\u003e\n    \u003cmeta http-equiv=\"X-UA-Compatible\" content=\"IE=Edge\" /\u003e\n\u003cmeta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8;charset=utf-8\"\u003e\n\u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=1\" /\u003e\n\u003cmeta name=\"HandheldFriendly\" content=\"true\"/\u003e\n\n\u003clink rel=\"canonical\" href=\"https://duckduckgo.com/\"\u003e\n\n\u003clink rel=\"stylesheet\" href=\"/s1049.css\" type=\"text/css\"\u003e\n\u003clink rel=\"stylesheet\" href=\"/t1049.css\" type=\"text/css\"\u003e\n\n\n\u003clink rel=\"shortcut icon\" href=\"/favicon.ico\" type=\"image/x-icon\" sizes=\"16x16 24x24 32x32 64x64\"/\u003e\n\u003clink rel=\"apple-touch-icon\" href=\"/assets/icons/meta/DDG-iOS-icon_60x60.png\"/\u003e\n\u003clink rel=\"apple-touch-icon\" sizes=\"76x76\" href=\"/assets/icons/meta/DDG-iOS-icon_76x76.png\"/\u003e\n\u003clink rel=\"apple-touch-icon\" sizes=\"120x120\" href=\"/assets/icons/meta/DDG-iOS-icon_120x120.png\"/\u003e\n\u003clink rel=\"apple-touch-icon\" sizes=\"152x152\" href=\"/assets/icons/meta/DDG-iOS-icon_152x152.png\"/\u003e\n\u003clink rel=\"image_src\" href=\"/assets/icons/meta/DDG-icon_256x256.png\"/\u003e\n\n\u003clink title=\"DuckDuckGo\" type=\"application/opensearchdescription+xml\" rel=\"search\" href=\"/opensearch.xml\"\u003e\n\n\u003cmeta name=\"twitter:site\" value=\"@duckduckgo\"\u003e\n\u003cmeta name=\"twitter:url\" value=\"https://duckduckgo.com/\"\u003e\n\n\u003cmeta property=\"og:url\" content=\"https://duckduckgo.com/\" /\u003e\n\u003cmeta property=\"og:site_name\" content=\"DuckDuckGo\" /\u003e\n\n\n    \u003ctitle\u003eDuckDuckGo\u003c/title\u003e\n\u003cmeta property=\"og:title\" content=\"DuckDuckGo\" /\u003e\n\u003cmeta name=\"twitter:title\" value=\"DuckDuckGo\"\u003e\n\n\n\u003cmeta name=\"description\" content=\"The search engine that doesn't track you. A superior search experience with smarter answers, less clutter and real privacy.\"\u003e\n\n\n  \u003c/head\u003e\n  \u003cbody id=\"pg-index\" class=\"page-index body--home\"\u003e\n    \u003cscript type=\"text/javascript\"\u003e\nvar settings_js_version = \"/s1847.js\",\n    locale = \"en_US\";\n\u003c/script\u003e\n\u003cscript type=\"text/javascript\" src=\"/locales/en_US/LC_MESSAGES/duckduckgo-duckduckgo+sprintf+gettext+locale-simple.20151112.063921.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\" src=\"/d1847.js\"\u003e\u003c/script\u003e\n\n\n\u003cscript type=\"text/javascript\"\u003e\n    DDG.page = new DDG.Pages.Home();\n\u003c/script\u003e\n\n\n\n    \u003cdiv class=\"site-wrapper  site-wrapper--home  js-site-wrapper\"\u003e\n\n        \u003cdiv class=\"site-wrapper-border\"\u003e\u003c/div\u003e\n\n\n\n            \u003cdiv class=\"header-wrap--home  js-header-wrap\"\u003e\u003c/div\u003e\n\n            \u003cdiv id=\"\" class=\"content-wrap--home\"\u003e\n              \u003cdiv id=\"content_homepage\" class=\"content--home\"\u003e\n                \u003cdiv class=\"cw--c\"\u003e\n                            \u003cdiv class=\"logo-wrap--home\"\u003e\n            \u003ca id=\"logo_homepage_link\" class=\"logo_homepage\" href=\"/about\"\u003e\n                About DuckDuckGo\n                \u003cspan class=\"logo_homepage__tt\"\u003eDuck it!\u003c/span\u003e\n            \u003c/a\u003e\n        \u003c/div\u003e\n\n                    \u003cdiv class=\"search-wrap--home\"\u003e\n                                \u003cform id=\"search_form_homepage\" class=\"search  search--home  js-search-form\" name=\"x\" method=\"POST\" action=\"/html\"\u003e\n            \u003cinput id=\"search_form_input_homepage\" class=\"search__input  js-search-input\" type=\"text\" autocomplete=\"off\" name=\"q\" tabindex=\"1\" value=\"\"\u003e\n            \u003cinput id=\"search_button_homepage\" class=\"search__button  js-search-button\" type=\"submit\" tabindex=\"2\" value=\"S\" /\u003e\n            \u003cinput id=\"search_form_input_clear\" class=\"search__clear  empty  js-search-clear\" type=\"button\" tabindex=\"3\" value=\"X\" /\u003e\n            \u003cdiv id=\"search_elements_hidden\" class=\"search__hidden  js-search-hidden\"\u003e\u003c/div\u003e\n            \u003cspan class=\"search__overlay  js-search-overlay\"\u003e\u003c/span\u003e\n        \u003c/form\u003e\n\n                    \u003c/div\u003e\n\n\n\n\n        \u003c!-- en_US All Settings --\u003e\n\u003cnoscript\u003e\n    \u003cdiv class=\"tag-home\"\u003e\n        The search engine that doesn't track you.\n        \u003cspan class=\"tag-home__links\"\u003e\n            \u003cspan class=\"js-homepage-cta\"\u003e\u003ca href=\"/spread\" class=\"tag-home__link\"\u003eHelp Spread DuckDuckGo!\u003c/a\u003e \u003cspan class=\"tag-home__links__sep\"\u003e|\u003c/span\u003e \u003c/span\u003e\u003ca href=\"/tour\" class=\"tag-home__link\"\u003eTake a Tour\u003c/a\u003e\n        \u003c/span\u003e\n    \u003c/div\u003e\n\u003c/noscript\u003e\n\u003cdiv class=\"tag-home  tag-home--slide  no-js__hide  js-tag-home\"\u003e\u003c/div\u003e\n        \u003cdiv id=\"error_homepage\"\u003e\u003c/div\u003e\n\n\n\n\n                \u003c/div\u003e \u003c!-- cw --\u003e\n             \u003c/div\u003e \u003c!-- content_homepage //--\u003e\n          \u003c/div\u003e \u003c!-- content_wrapper_homepage //--\u003e\n          \u003cdiv id=\"footer_homepage\" class=\"foot-home  js-foot-home\"\u003e\u003c/div\u003e\n\n\u003cscript type=\"text/javascript\"\u003e\n    {function seterr(str) {\n        var error=document.getElementById('error_homepage');\n        error.innerHTML=str;\n        $(error).css('display','block');\n    }\n    var err=new RegExp('[\\?\\\u0026]e=([^\\\u0026]+)');var errm=new Array();errm['2']='no search';errm['3']='search too long';errm['4']='not UTF\\u002d8 encoding';if (err.test(window.location.href)) seterr('Oops, '+(errm[RegExp.$1]?errm[RegExp.$1]:'there was an error.')+' \u0026nbsp;Please try again');};if (ip) setTimeout('nuo(1)',250);nip(1)\n\n    if (kurl) {\n      document.getElementById(\"logo_homepage_link\").href += (document.getElementById(\"logo_homepage_link\").href.indexOf('?')==-1 ? '?t=i' : '') + kurl;\n    }\n\u003c/script\u003e\n\n\n\n\n    \u003c/div\u003e \u003c!-- site-wrapper --\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n\nThis is a link:\n\n                About DuckDuckGo\n                Duck it!\n\nThis is a link:\n Help Spread DuckDuckGo!\nThis is a link:\n Take a Tour\n```\n\n## Quandl Example\n\nThis example gets the stocks from AAPL into a dataframe and prints it.\n\n### Run the Example\n\n```python3\npython3 quandl-example.py\n```\n\n#### Output\n\n```python3\nfirst date: 2001-12-31\nTotal days of stock data available: 4\n[Finished in 1.6s]\n```\n\n## Json to Python Object Example\n\nThis example takes a json object and converts it to python and iterates through the values. It works for Python 3 or Python 2.7\n\n### Run the Example\n\n```python3\npython3 json-example.py\n```\n\n## Foursquare API Example\n\nThis example connects to Foursquare and asks for a city, country input and venue name and returns back the JSON and the Latitude and Longitude as well as the link to display the Qwant Map zoomed into that location\n\n### Run the Example\n\n```python3\npython 4sq-example.py\n```\n\n#### Output\n\n```python3\n\nWhat city do you want to search in? (no spaces, include country): London,UK\nWhat is the name of the venue to search?: Millenium Hotel\n{\n    u'geocode': {\n        u'parents': [\n\n        ],\n        u'what': u'',\n        u'where': u'londonuk',\n        u'feature': {\n            u'highlightedName': u'\u003cb\u003eLondon\u003c/b\u003e,\n            GreaterLondon,\n            \u003cb\u003eUK\u003c/b\u003e',\n            u'displayName': u'London,\n            GreaterLondon,\n            UnitedKingdom',\n            u'name': u'London',\n            u'longId': u'72057594040571679',\n            u'cc': u'GB',\n            u'id': u'geonameid: 2643743',\n            u'geometry': {\n                u'center': {\n                    u'lat': 51.50853,\n                    u'lng': -0.12574\n                },\n                u'bounds': {\n                    u'sw': {\n                        u'lat': 51.28467404417054,\n                        u'lng': -0.5085579279369435\n                    },\n                    u'ne': {\n                        u'lat': 51.691643999655895,\n                        u'lng': 0.33418999705203406\n                    }\n                }\n            },\n            u'matchedName': u'London,\n            GreaterLondon,\n            UK',\n            u'woeType': 7,\n            u'slug': u'london'\n        }\n    },\n    u'venues': [\n        {\n            u'verified': True,\n            u'name': u'MillenniumHotelLondonMayfair',\n            u'referralId': u'v-1434850451',\n            u'url': u'http: //www.millenniumhotels.co.uk',\n            u'storeId': u'',\n            u'hereNow': {\n                u'count': 0,\n                u'groups': [\n\n                ],\n                u'summary': u'Nobodyhere'\n            },\n            u'specials': {\n                u'count': 0,\n                u'items': [\n\n                ]\n            },\n            u'contact': {\n                u'facebookName': u'Millennium\u0026CopthorneHotelsEurope',\n                u'twitter': u'millenniumeu',\n                u'phone': u'+442076299400',\n                u'facebook': u'456685494411593',\n                u'formattedPhone': u'+442076299400',\n                u'facebookUsername': u'MillenniumEU'\n            },\n            u'location': {\n                u'city': u'Mayfair',\n                u'cc': u'GB',\n                u'country': u'UnitedKingdom',\n                u'postalCode': u'W1K2HP',\n                u'state': u'GreaterLondon',\n                u'formattedAddress': [\n                    u'44GrosvenorSquare',\n                    u'Mayfair',\n                    u'GreaterLondon',\n                    u'W1K2HP',\n                    u'UnitedKingdom'\n                ],\n                u'address': u'44GrosvenorSquare',\n                u'lat': 51.51086806955976,\n                u'lng': -0.1512632169763817\n            },\n            u'stats': {\n                u'tipCount': 31,\n                u'checkinsCount': 3586,\n                u'usersCount': 1559\n            },\n            u'id': u'4ac518b5f964a52090a020e3',\n            u'categories': [\n                {\n                    u'pluralName': u'Hotels',\n                    u'primary': True,\n                    u'name': u'Hotel',\n                    u'shortName': u'Hotel',\n                    u'id': u'4bf58dd8d48988d1fa931735',\n                    u'icon': {\n                        u'prefix': u'https: //ss3.4sqi.net/img/categories_v2/travel/hotel_',\n                        u'suffix': u'.png'\n                    }\n                }\n            ]\n        }\n    ]\n}\n\nLat/Long: 51.5108680696, -0.151263216976\n```\n\n## argparse Example\n\nThis example sets some basic args.\n\n### Run the Example\n\n```python3\npython3 argparse.py -h\n```\n\nReturns:\n\n```python3\nusage: argparse example [-h] [-a] [-v] [--verbose]\n\nExample on how to use argparse\n\npositional arguments:\n  +a             Turn A on\n\noptional arguments:\n  -h, --help     show this help message and exit\n  -a             Turn A off\n  -v, --version  show program's version number and exit\n  --verbose      verbose flag\n```\n\n## Shodan Count Example\n\nThis example connects to shodan api via your configs.py file with proper api key variable set and then queries for nginx in Glasgow, GB.\n\n### Run the Example\n\n```python3\npython3 shodan-example.py\n```\n\n#### Returns\n\n```python3\nResults found: 246\n[Finished in 0.6s]\n```\n\n## Google GEO and Shodan Example\n\nThis example takes an address, gets the lat/long, and searches in shodan for matches near that location.\n\n### Run the Example\n\n```python3\npython3 get-geo-example.py\n```\n\n#### Returns\n\n```python3\ngeo:58.98691099999999,-2.960873,3\nResults found: 572\n[Finished in 0.7s]\n```\n\n## RethinkDB Example\n\nThis example takes pastebin archive daily json data into a test table in rethinkdb and pulls out values from it.\n\n### Run the rethinkdb Example\n\n```python3\npython3 rethink-example.py\n```\n\n### Returns rethink stuff\n\n## Websockify Example\n\nThis example uses websockify.\n\n```python3\npython3 websockify-example.py :8015 :80\n```\n\n### Returns\n\n???\n\n## Imaplib Example\n\nThis example uses imaplib.\n\n### Run the imaplib example\n\n```python3\npython3 imaplib-example.py [your gmail] [your password]\n```\n\n### Returns\n\nLatest unread mail from account and continues to run until you `CTRL+C`\n\n*More coming soon!*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjames-see%2Fpython-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjames-see%2Fpython-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjames-see%2Fpython-examples/lists"}