background preloader

Python

Facebook Twitter

Opsgenie - Alerts. Authentication — Requests 2.18.4 documentation. This document discusses using various kinds of authentication with Requests. Many web services require authentication, and there are many different types. Below, we outline various forms of authentication available in Requests, from the simple to the complex. Basic Authentication Many web services that require authentication accept HTTP Basic Auth.

Making requests with HTTP Basic Auth is very simple: >>> from requests.auth import HTTPBasicAuth>>> requests.get(' auth=HTTPBasicAuth('user', 'pass'))<Response [200]> In fact, HTTP Basic Auth is so common that Requests provides a handy shorthand for using it: >>> requests.get(' auth=('user', 'pass'))<Response [200]> Providing the credentials in a tuple like this is exactly the same as the HTTPBasicAuth example above. netrc Authentication If credentials for the hostname are found, the request is sent with HTTP Basic Auth.

Digest Authentication OAuth 1 Authentication Other Authentication. Python Console - Help | PyCharm. In this section: Important notes Python console appears as a tool window every time you choose the corresponding command on the menu.An interactive console is divided into two panes: the lower pane serves for user input, the upper pane displays results and messages.Use up and down arrow keys to browse through the history of executed commands, and repeat the desired ones.Python console is available for both local and remote interpreters.Color and font scheme of a console is configurable on the Console Colors and Console Fonts pages of the Color Scheme editor settings. Toolbar Context menu commands.

Virtual Environments — The Hitchhiker's Guide to Python. Virtualenv is a tool to create isolated Python environments. virtualenv creates a folder which contains all the necessary executables to use the packages that a Python project would need. Basic Usage Create a virtual environment for a project: $ cd my_project_folder $ virtualenv my_project virtualenv my_project will create a folder in the current directory which will contain the Python executable files, and a copy of the pip library which you can use to install other packages. The name of the virtual environment (in this case, it was my_project) can be anything; omitting the name will place the files in the current directory instead. This creates a copy of Python in whichever directory you ran the command in, placing it in a folder named my_project.

You can also use the Python interpreter of your choice (like python2.7). $ virtualenv -p /usr/bin/python2.7 my_project or change the interpreter globally with an env variable in ~/.bashrc: $ export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python2.7. Releases for Mac OS X. Installing cx_Oracle Driver on El Capitan.

Download Oracle instantclient Navigate to the ‘Oracle Instant Client Downloads’ page. Download instantclient-basic-macos.x64-12.1.0.2.0.zip and instantclient-sdk-macos.x64-12.1.0.2.0.zip You will need an Oracle account to proceed with the download. Enter the ‘~/Downloads’ folder in Terminal, and unzip both downloads: cd ~/Downloads unzip instantclient-basic-macos.x64-12.1.0.2.0.zip unzip instantclient-sdk-macos.x64-12.1.0.2.0.zip mv instantclient_12_1 /usr/local/opt/instantclient_12_1 cd /usr/local/opt/instantclient_12_1 ln -s libclntsh.dylib.12.1 libclntsh.dylib Configure environment variables export ORACLE_HOME=/usr/local/opt/instantclient_12_1 export FORCE_RPATH=1 Download and install cx_Oracle Verify cx_Oracle was correctly installed python -c "import cx_Oracle" If this fails then you may see the following exception: pip install --no-cache-dir --allow-external --allow-unverified cx_oracle Thanks to Christopher Jones for help simplifying the above steps.

Instant Client downloads for Mac OS X (Intel x86) Installation Installing Instant Client 12.1 on macOS Instant Client 12.1.0.2 supports macOS El Capitan, Yosemite and Mavericks. 1. Download the desired Instant Client ZIP files. 2. Cd ~ unzip instantclient-basic-macos.x64-12.1.0.2.0.zip unzip instantclient-sqlplus-macos.x64-12.1.0.2.0.zip 3. Cd ~/instantclient_12_1 ln -s libclntsh.dylib.12.1 libclntsh.dylib Note: OCCI programs will additionally need: ln -s libocci.dylib.12.1 libocci.dylib 4.

Export PATH=~/instantclient_12_1:$PATH 5. Sqlplus hr/welcome@localhost/orcl Note: Custom applications should link with -rpath set to the directory containing Instant Client 12.1. Installing Instant Client 11.2 on macOS 2. Cd ~ unzip instantclient-basic-macos.x64-11.2.0.4.0.zip unzip instantclient-sqlplus-macos.x64-11.2.0.4.0.zip cd ~/instantclient_11_2 ln -s libclntsh.dylib.11.1 libclntsh.dylib ln -s libocci.dylib.11.1 libocci.dylib 4.

Mkdir ~/lib ln -s ~/instantclient_11_2/{libclntsh.dylib.11.1,libnnz11.dylib, libociei.dylib} ~/lib/ 5. 6. More Information. Ipython/README.rst at master · ipython/ipython. Installing Oracle Instant Client 12.1 and cx_Oracle on macOS Sierra | rbrtmrtn. First off, download the Instant Client, either Basic or Basic Lite. I usually opt for Basic Lite because it’s all I need, but if you work in a language other than English you might want Basic. Also grab the SDK package a few rows down. I also recommend getting sqlplus, because it’s nice to have a CLI sometimes and your DBA will be impressed. Now fire up Terminal and run a few things. It should Just Work as long as you’ve downloaded everything to ~/Downloads. # make a home for oracle and go there mkdir -p ~/Library/Oracle && cd $_ # unzip everything unzip '~/Downloads/instantclient-*.zip' # create some symlink ln -s libclntsh.dylib.12.1 libclntsh.dylib At this point you should be able to run .

Usually at this point I grab SQL Developer and try connecting to something. Now it’s time to install cx_Oracle. The first of these is pretty straightforward: ORACLE_HOME. The other one is DYLD_LIBRARY_PATH. So add these lines to your ~/.bash_profile: Guess what? And that’s a wrap! Like this: Ruby - how can I uninstall using homebrew? - Super User. Remove all Python packages installed with PIP. Connecting to Oracle with Toad - Mac Edition (updated for OS X 10.9 Mavericks!) - Toad - Mac Edition Blog - Toad – Mac Edition. Note: This article covers Mac OS X 10.8 (Mountain Lion) and 10.9 (Mavericks). For instructions related to Mac OS X 10.7 (Lion), please see here.

There are two ways to connect to Oracle on a Mac using Toad - Mac Edition: manually and via Net Service names. We'll cover each in detail. The Easy Way Ok, if you want to get up and running in a flash, the only thing you need to do is install Oracle's Instant Client. Download the Instant Client from OTN: it anywhere you wantRun Toad CAUTION: download the 64-bit Instant Client for use with Toad - Mac Edition. If this is the first time you're running Toad, it'll find the driver automatically using Spotlight Search behind the scenes.

That's all you have to do! The Fancy Way (using Net Service Names) Ok, for those of you in corporate environments or with a bunch of databases already configured in a tnsnames.ora file, this is for you. First, complete the steps above. Export PATH. Installing CX Oracle for Python & Mac OS X. Instructions exist around the web, but they seem to be piecemeal and incomplete. Installing cx_Oracle for Python/ Mac OSX Portions taken from (in case that link ever dies.) Assume you've got homebrew installed. Download the following files from Oracle Create a directory /usr/lib/share/oracle export ORACLE_HOME=/usr/lib/share/oracle export VERSION=11.2.0.3.0 export ARCH=x86_64 mkdir -p $ORACLE_HOME Unpack both files to that directory: cd $ORACLE_HOME tar -xzf instantclient-basic-$VERSION-macosx-x64.zip tar -xzf instantclient-sdk-$VERSION-macosx-x64.zip ln -s libclntsh.dylib.11.2 libclntsh.dylib ln -s libocci.dylib.11.2 libocci.dylib export DYLD_LIBRARY_PATH=$ORACLE_HOME export LD_LIBRARY_PATH=$ORACLE_HOME (Note I did not have to do anything with ottclasses.zip as suggested in the original utexas instructions.)

If you're using Pip: Last step is to simply run pip, you might have to add an arch flag: env ARCHFLAGS="-arch $ARCH" pip install cx_Oracle If you're building from source: Notes Basically: Error "ORA-21561: OID generation failed" Connecting to Oracle with a Mac | Tableau Software. How to edit your Mac's Hosts file, and why you would want to. If you're setting up a new web server or another device that's going to be connected to the Internet and you want to put it through its paces before it's live, or if you're having trouble with spyware and adware networks, there's an invisible file on your Mac that can help.

It's called the Hosts file, and this is how to use it. The Domain Name System When you type in the domain name of a web site you want to visit there's a lot happening behind the scenes. Every web site, every service, almost every device connected to the Internet has a unique numeric address that tells all the other devices where it is — its TCP/IP address. The Domain Name System (DNS) translates those numeric addresses into something a bit more recognizable and memorable to humans, like, "www.imore.com" for example.

The Hosts file The Domain Name System and its associated cache is your Mac's standard way of knowing how to get to where it's going on the Internet, but there's another file that can be very useful. Get Your Mac Ready for Python Programming – PyLadies. A PDX PyLady March 06, 2013 | Tag: » absolute beginner, getting started, Mac OS X As an absolute beginner to programming, you can very quickly learn to do lots of cool things using just your Python interpreter and simple Python scripts. However, you're going to want a few more tools eventually to help you expand to more complex projects. Why not start getting familiar with them now? For me, the hardest thing about branching out was figuring out what tools I really needed and how to interpret their install instructions. 1.

Xcode is Apple's Integrated Development Environment (IDE), and there are some tools that come with it that we'll need later. Once Xcode is installed, you still need to install the Apple command line tools! 2. If you've never used Terminal or some kind of command line interface before, it's a good idea to take a minute to familiarize yourself with how they work. . $ cd Command line instructions usually start with $, which represents the end of your prompt. . $ mkdir Code 3. 4.