This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from xlrd import open_workbook | |
def is_row_hidden(sheet, row_n): | |
try: | |
if sheet.rowinfo_map[row_n].hidden: | |
return True | |
except KeyError: | |
# empty row, treat as hidden | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from xlrd import open_workbook | |
from xlutils.copy import copy | |
def save_workbook_copy(file_from, file_to): | |
rb = open_workbook(file_from, formatting_info=True) | |
wb = copy(rb) # a writable copy (I can't read values out of this, only write to it) | |
w_sheet = wb.get_sheet(0) # the sheet to write to within the writable copy | |
row_index = 0 | |
col_index = 0 | |
w_sheet.write(row_index, col_index,'DataToBeWritten') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import logging | |
def get_csv_lines(file_name, encoding='cp1251'): | |
try: | |
lines = [] | |
with open(file_name, 'rb') as f: | |
reader = csv.reader(f, delimiter=";") | |
for line in reader: | |
decoded_line = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(?<=<h2>).+(?=</h2>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Example of OAuth 2.0 process with client-side only web page. | |
We can access to user's resources without providing a client_secret! | |
Given access_token will be short-lived, about 1 or 2 hours, whereas | |
access_token given by server-side workflow is long-lived, up to 60 days. | |
http://stackoverflow.com/questions/9067947/facebook-access-token-server-side-vs-client-side-flows | |
API of facebook is used: https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow | |
""" | |
import webbrowser | |
import urllib2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Example of less-legged client workflow using OAuth means. | |
OAuth 1.0a is a 3-legged process. Less-legged process is not an OAuth 1.0a, | |
it just use similiar means, but people used to call it OAuth... | |
With 2-legged process user is not interacted in process. | |
In such workflow client application is acting like a user. | |
So client can fetch resources avaliable either to all users, either it can | |
access to resources owned by itself (even private). |
NewerOlder