Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
KishanBagaria committed Aug 23, 2018
1 parent 4aa8b27 commit afb306a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ all: clean build
clean:
rm -rf dist/ build/ *.egg-info
build:
./setup.py sdist bdist_wheel
python2 setup.py sdist bdist_wheel

upload-test:
twine upload -r pypitest dist/*
Expand Down
32 changes: 21 additions & 11 deletions dAbot/dAbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def except_hook(type, value, traceback):
'given_llama_count' : '<td class="f">Given:</td><td class="f">([\d,]+|No).+?</td>',
'badges_count' : '([\d,]+|No) Badges sent, ([\d,]+|No) Badges received',
'points_balance' : 'data-balance="([\d,]+)"',
'dev_names' : r'([A-Za-z0-9-]+)\.deviantart\.com',
'dev_names' : r'www\.deviantart\.com/([A-Za-z0-9-]+)',
'llama_dev_name' : 'Give a <strong>Llama Badge</strong> to <.+>([A-Za-z0-9-]+)<.+>\?',
'llama_type' : r'You have given\s+a\s+([a-zA-Z ]+?)\s+Badge\s+to',
'llama_error_msg' : '<li class="field_error".*?>(.+)</li>',
Expand Down Expand Up @@ -201,11 +201,12 @@ def login(username, password):
echo('Downloading login page')
login_html = dA.get(url['login']).text
params = {
'validate_token' : get_validate_token(login_html),
'validate_key' : get_validate_key(login_html),
'ref' : url['login_ref'],
'username' : username,
'password' : password,
'ref' : url['login_ref']
'remember_me' : 1,
'validate_token' : get_validate_token(login_html),
'validate_key' : get_validate_key(login_html)
}
echo('Logging in as %s' % username)
post = dA.post(url['login'], data=params)
Expand Down Expand Up @@ -540,15 +541,16 @@ def sigint_handler(signum, frame):
'Windows NT 6.1',
'Macintosh; Intel Mac OS X 10_10_3',
'Macintosh; Intel Mac OS X 10_11_1',
'Macintosh; Intel Mac OS X 10_12_5',
'Macintosh; Intel Mac OS X 10_13_1'
'Macintosh; Intel Mac OS X 10_12_6',
'Macintosh; Intel Mac OS X 10_13_0'
]
USER_AGENTS = [
'Mozilla/5.0 (%s) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36',
'Mozilla/5.0 (%s) Gecko/20100101 Firefox/46.0',
'Mozilla/5.0 (%s) Gecko/20100101 Firefox/47.0',
'Mozilla/5.0 (%s) Gecko/20100101 Firefox/48.0',
'Mozilla/5.0 (%s) Gecko/20100101 Firefox/49.0'
'Mozilla/5.0 (%s) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36',
'Mozilla/5.0 (%s) Gecko/20100101 Firefox/51.0',
'Mozilla/5.0 (%s) Gecko/20100101 Firefox/52.0',
'Mozilla/5.0 (%s) Gecko/20100101 Firefox/53.0',
'Mozilla/5.0 (%s) Gecko/20100101 Firefox/54.0'
]
SPAM_FILTER_START_WAIT = 60*30 # 30 minutes
SPAM_FILTER_EACH_WAIT = 0
Expand Down Expand Up @@ -663,11 +665,19 @@ def pick_da_useragent():

dA = requests.session()
req = requests.session()
PROXIED = False
for _ in [dA, req]:
_.trust_env = False
_.hooks = {'response': response_hook}
_.headers['Accept-Encoding'] = 'gzip,deflate'
_.headers['Accept'] = '*/*'
_.headers['Accept-Encoding'] = 'gzip, deflate'
_.headers['Accept-Language'] = 'en'
if PROXIED:
_.proxies = {
'http': '127.0.0.1:8080',
'https': '127.0.0.1:8080'
}
_.verify = False

LlamaTransactions = set()

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name='dAbot',
version='2017.09.15',
version='2018.08.24',
description='CLI tool to automate stuff on DeviantArt.com',
url='https://github.com/KishanBagaria/dAbot',
author='Kishan Bagaria',
Expand Down

0 comments on commit afb306a

Please sign in to comment.