import requests
contacts_data = {
"givenName": "Pavel",
"surname": "Bansky",
"emailAddresses": [
{
"address": "pavelb@fabrikam.onmicrosoft.com",
"name": "Pavel Bansky"
}
],
"businessPhones": [
"+1 732 555 0102"
]
}
r = requests.post('https://graph.microsoft.com/v1.0/me/contacts', json=contacts_data)
from setuptools import setup
from my_pkg import constants
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md')) as f:
long_description = f.read()
setup(
name='my_pkg',
version=constants.MY_PKG_VERSION,
description='Pkg description',
author='Your Name',
author_email='your@ema.il',
url='http://github.com/some/user',
packages=[
'my_pkg',
'my_pkg.abstractions',
'my_pkg.exceptions',
],
long_description=long_description,
long_description_content_type='text/markdown',
include_package_data=True,
install_requires=[],
python_requires='>=3.4',
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Natural Language :: English",
"Operating System :: OS Independent",
"Development Status :: 1 - Planning",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Topic :: Software Development :: Libraries"],
package_data={
'': ['*.md', '*.txt', '*.json']
},
keywords='my_pkg',
license='MIT',
)
entry_points={
'console_scripts': ['your_command=my_pkg.cli.command_line:main'],
},
with Image.open('sts.png').convert("RGBA") as your_image:
do_things(your_image)
def draw_text_on_image(text,
input_file='image.png',
output_file='new_image.png',
dimensions=(1047, 377),
insert_position=(900, 50),
):
with Image.open(input_file).convert("RGBA") as your_image:
temporary_image = Image.new('RGBA', dimensions, (255, 255, 255, 0))
draw = ImageDraw.Draw(temporary_image)
draw.text(insert_position, text, fill=(200, 0, 0, 255))
del draw
output = Image.alpha_composite(your_image, temporary_image)
output.save(output_file)
for filename in os.listdir(WATCH_DIRECTORY):
file_data = os.path.join(WATCH_DIRECTORY, filename)
try:
with open(file_data, 'rb') as file:
data_local = pickle.load(file)
file.close()
print(data_local) # здесь вывод данных с одного файла, открытого в данный момент
g.data_local = data_local # здесь значение g.data_local затирается последним (на каждой итерации)
return g.data_local().all()