import requests
import time
import hashlib
import nacl.signing
import nacl.encoding
public_key = 'your_public_key_here'
secret_key = 'your_secret_key_here'
http_method = "POST"
route_path = "/get-item"
query_params = "Amount=%220.25%22&Limit=%22100%22&Offset=%22150%22&Order=%22desc%22"
body_string = ""
timestamp = str(int(time.time()))
non_signed_string = f"{http_method}{route_path}?{query_params}{body_string}{timestamp}"
signing_key = nacl.signing.SigningKey(secret_key, encoder=nacl.encoding.HexEncoder)
signed = signing_key.sign(non_signed_string.encode())
signature_hex = signed.signature.hex()
headers = {
'X-Api-Key': public_key,
'X-Sign-Date': timestamp,
'X-Request-Sign': signature_hex,
'Content-Type': 'application/json'
}
url = f"https://api.dmarket.com{route_path}?{query_params}"
response = requests.post(url, headers=headers, json={})
print(f"Status Code: {response.status_code}")
print(f"Response: {response.json()}")
{
"currentPage": 1,
"totalPages": 173,
"pageSize": 15,
"itemsInPage": 15,
"totalItems": 2591,
"items": [
{
"eventId": 314749,
"eventType": 7,
"eventStatus": 1,
"buyerOrganizationName": "NAXÇIVAN MUXTAR RESPUBLİKASI QAZ İSTİSMAR XİDMƏTİ",
"eventName": "Qaz tikinti quraşdırma materialları və avadanlıqlarının satınalınması",
"publishDate": "2024-08-27T19:50:59",
"endDate": "2024-09-18T18:00:00",
"hasNewVersion": false,
"awardedParticipantName": null,
"awardedParticipantVoen": null,
"documentViewType": 0,
"actualVersionId": 0,
"privateRfxId": 93247
}
.....
]
}
random_id Unique identifier to avoid resending the message.
int (number), accessible for versions from 5.45
vk.messages.send(
user_id=event.user_id,
message='No results'
)
vk.method('messages.send', {
'user_id': user_id,
'message': msg,
'random_id': random_id
})
sudo apt install screen
screen -S mybot
python3 bot.py
screen -r mybot
- чтобы открыть при следующем входе pip install pipenv
sudo apt install software-properties-common python-software-properties
sudo add-apt-repository ppa:pypa/ppa
sudo apt update
sudo apt install pipenv
sudo apt install python3-pip
sudo apt install python-pip
pip install --help
--user Install to the Python user install directory for your platform. Typically ~/.local/, or %APPDATA%\Python on
Windows. (See the Python documentation for site.USER_BASE for full details.)
sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get install python3
sudo apt-get install -y python3-pip
pip3 install virtualenv
mkdir django-apps
cd django-apps
virtualenv env
. env/bin/activate
(env) sammy@ubuntu:$ pip install django
(env) sammy@ubuntu:$ django-admin --version
(env) sammy@ubuntu:$ django-admin startproject app