This file contains hidden or 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
#!python.exe | |
# coding=utf-8 | |
# vim: set fileencoding=utf-8 : | |
#~ print "Content-Type: text/html\r\n" | |
''' | |
надо | |
Установка статуса (SET_STATUS) | |
Изменение фотографий и фотоальбомов (PHOTO_CONTENT) | |
Доступ к основной информации (VALUABLE_ACCESS) |
This file contains hidden or 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
#~ Перезагрузка Dlink DIR-100 скриптом How to Reboot Your Router Dir-100 restart telnet | |
import requests | |
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1'} | |
session = requests.Session() | |
content=session.post('http://192.168.1.1/login.htm', { | |
'uname': 'admin', |
This file contains hidden or 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
#~ How to upload image to imgur as a specific user | |
#~ https://api.imgur.com/endpoints/image#image-upload | |
client_id = '152n90e218cakme' | |
access_token ='07566baa9e20c57e71203191dde1daffc6250ad3' | |
#~ Get Access token from : from imgurpython import ImgurClient ;) | |
import urllib2 | |
import urllib |
This file contains hidden or 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
#! python2 | |
# //coding: utf-8 | |
# coding=utf-8 | |
# -*- coding: utf-8 -*- | |
# vim: set fileencoding=utf-8 : | |
a = u'1a' | |
a = a.decode('utf-8').encode('cp1251') | |
print a |
This file contains hidden or 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 -*- | |
from lxml import html | |
#~ response = requests.get('https://www.yahoo.com/news/') | |
#~ parsed_body = html.fromstring(response.text) | |
responsetext='<ul><li><span>Model No.:</span><em>CN-374181929</em></li><li><span>Material:</span><em>ABS</em></li><li><span>Product Size:</span><em>4.5cm</em></li><li><span>Product Weight:</span><em>0.053kg</em></li><li><span>Features:</span><em>Phthalates Free</em></li><li></li><li><span>Package Size:</span><em>13*7.5*4.9cm</em></li><li><span>Package Weight:</span><em>0.072kg</em></li><li><span>Package Type:</span><em>colorbox</em></li><li></li><li><span>QTY/CTN:</span><em>160PCS</em></li><li><span>Case Size:</span><em>58.5*43*40cm</em></li><li><span>N.W:</span><em>8.5kg</em></li><li><span>G.W:</span><em>10.5kg</em></li><li><span>Volume:</span><em>0.1CBM</em></li></ul>' | |
parsed_body = html.fromstring(responsetext) | |
data = parsed_body.xpath(".//li") | |
print len(data) |
This file contains hidden or 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: utf8 | |
xml = '''<?xml version="1.0" encoding="UTF-8"?> | |
<soft> | |
<os> | |
<item name="linux" dist="ubuntu"> | |
This text about linux | |
</item> | |
<item name="mac os"> | |
Apple company |
NewerOlder